:root {
  --bg: #070b12;
  --bg-2: #0b111c;
  --panel: rgba(14, 22, 34, 0.92);
  --panel-2: rgba(18, 29, 44, 0.94);
  --panel-strong: #111e2d;
  --text: #edf7ff;
  --text-strong: #ffffff;
  --muted: #91a5b8;
  --muted-2: #668096;
  --line: rgba(128, 225, 239, 0.16);
  --line-strong: rgba(132, 237, 247, 0.38);
  --accent: #20d6c7;
  --accent-strong: #7af9ee;
  --accent-soft: rgba(32, 214, 199, 0.13);
  --violet: #7d7cff;
  --violet-soft: rgba(125, 124, 255, 0.14);
  --amber: #f2b84b;
  --amber-soft: rgba(242, 184, 75, 0.16);
  --rose: #ff6f91;
  --green: #48e39b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --radius: 8px;
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(110deg, rgba(32, 214, 199, 0.09), transparent 24%),
    linear-gradient(250deg, rgba(125, 124, 255, 0.1), transparent 28%),
    radial-gradient(circle at 70% 0%, rgba(242, 184, 75, 0.08), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 82%);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(32, 214, 199, 0.035), transparent 12%, transparent 88%, rgba(125, 124, 255, 0.035)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 6px);
  z-index: -1;
}

.view {
  position: relative;
}

.view::before {
  content: "";
  display: none;
}

.view::after {
  content: "";
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

#app {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(19, 30, 46, 0.98), rgba(8, 13, 21, 0.98)),
    #0b111c;
  border-right: 1px solid var(--line);
  color: var(--text);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 16px 0 50px rgba(0, 0, 0, 0.24);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--violet), var(--amber));
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 84px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.09), rgba(125, 124, 255, 0.08)),
    rgba(255, 255, 255, 0.025);
  box-shadow: var(--inner-glow);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.95), rgba(125, 124, 255, 0.85));
  color: #061018;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(32, 214, 199, 0.34);
}

.brand-logo {
  display: block;
  object-fit: contain;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.82),
    0 0 26px rgba(32, 214, 199, 0.28),
    0 0 46px rgba(125, 124, 255, 0.18);
}

.sidebar-logo {
  width: 100%;
  height: auto;
  max-height: 78px;
  padding: 3px;
  flex: 0 0 auto;
}

.boot-logo {
  width: 286px;
  height: auto;
  padding: 4px;
}

.login-logo {
  width: min(330px, 100%);
  height: auto;
  padding: 4px;
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: flex;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong);
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 9px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #b6c6d4;
  padding: 11px 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 160ms ease;
}

.nav-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted-2);
  box-shadow: 0 0 0 rgba(32, 214, 199, 0);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background:
    linear-gradient(90deg, rgba(32, 214, 199, 0.18), rgba(125, 124, 255, 0.12)),
    rgba(255, 255, 255, 0.055);
  color: var(--text-strong);
  border-color: var(--line-strong);
  font-weight: 750;
}

.nav-item.active::before {
  background: var(--accent);
  box-shadow: 0 0 14px rgba(32, 214, 199, 0.82);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  background:
    linear-gradient(180deg, rgba(32, 214, 199, 0.08), rgba(125, 124, 255, 0.055)),
    rgba(255, 255, 255, 0.035);
}

.sidebar-note strong {
  color: var(--accent-strong);
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(105deg, rgba(32, 214, 199, 0.12), transparent 42%),
    linear-gradient(280deg, rgba(125, 124, 255, 0.12), transparent 40%),
    rgba(10, 17, 27, 0.76);
  box-shadow: var(--shadow), var(--inner-glow);
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  color: var(--text-strong);
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 820px;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.mini-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 38px;
  padding: 8px 13px;
  transition: 150ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #38a9ff);
  color: #031018;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(32, 214, 199, 0.22);
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--accent-strong);
  background: rgba(32, 214, 199, 0.08);
}

.mini-button {
  min-height: 30px;
  padding: 5px 10px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 13px;
}

.mini-button:hover {
  color: var(--accent-strong);
  border-color: var(--line-strong);
}

.mini-button:disabled,
.mini-button:disabled:hover {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.full-width {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(430px, 0.88fr);
  gap: 20px;
  align-items: start;
}

#imageView .split-layout {
  grid-template-columns: minmax(360px, 0.86fr) minmax(520px, 1.14fr);
}

.library-search-panel {
  margin-bottom: 16px;
}

.library-search-header {
  margin-bottom: 12px;
}

.library-search-summary {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  text-align: right;
}

.dashboard-root {
  display: grid;
  gap: 18px;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  min-height: 156px;
  border: 1px solid rgba(122, 249, 238, 0.24);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  background:
    linear-gradient(105deg, rgba(32, 214, 199, 0.2), transparent 44%),
    linear-gradient(280deg, rgba(125, 124, 255, 0.22), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 22px),
    rgba(8, 14, 24, 0.92);
  box-shadow: 0 0 54px rgba(32, 214, 199, 0.13), var(--inner-glow);
}

.dashboard-hero::after,
.dashboard-panel::after,
.metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(122, 249, 238, 0.07), transparent);
  transform: translateY(-100%);
  animation: scanline 6s linear infinite;
}

.dashboard-kicker,
.dashboard-panel-head span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.dashboard-hero h2 {
  margin: 8px 0 8px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.dashboard-hero p {
  margin: 0;
  color: #b7c9d8;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 132px;
  border: 1px solid rgba(122, 249, 238, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.13), rgba(125, 124, 255, 0.1)),
    rgba(10, 17, 27, 0.82);
  box-shadow: var(--inner-glow), 0 16px 46px rgba(0, 0, 0, 0.22);
}

.metric-ring {
  width: 76px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.96) 0 52%, transparent 53%),
    conic-gradient(var(--accent-strong) calc(var(--level) * 1%), rgba(125, 124, 255, 0.22) 0);
  box-shadow: 0 0 28px rgba(32, 214, 199, 0.28);
}

.metric-ring span {
  font-size: 19px;
  font-weight: 900;
  color: #ffffff;
}

.metric-card h3,
.dashboard-panel h3 {
  margin: 0;
  color: var(--text-strong);
}

.metric-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(128, 225, 239, 0.2);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 280px;
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.08), rgba(125, 124, 255, 0.075)),
    rgba(10, 17, 27, 0.78);
  box-shadow: var(--shadow), var(--inner-glow);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 7% 48%, rgba(122, 249, 238, 0.18), transparent 18%),
    linear-gradient(90deg, rgba(122, 249, 238, 0.12), transparent 42%, rgba(125, 124, 255, 0.1)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 32px);
  opacity: 0.9;
}

.topbar::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  width: min(520px, 48%);
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent-strong), var(--violet));
  box-shadow: 0 0 18px rgba(122, 249, 238, 0.65);
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.dashboard-wide {
  grid-column: span 2;
}

.dashboard-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.pulse-chart {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(rgba(122, 249, 238, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.025);
  background-size: 100% 25%;
}

.pulse-day {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
}

.pulse-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
}

.pulse-bar {
  width: 9px;
  min-height: 6px;
  border-radius: 999px 999px 2px 2px;
  box-shadow: 0 0 16px currentColor;
}

.pulse-bar.asset,
.chart-legend .asset {
  color: var(--accent-strong);
  background: var(--accent-strong);
}

.pulse-bar.image,
.chart-legend .image {
  color: #38a9ff;
  background: #38a9ff;
}

.pulse-bar.video,
.chart-legend .video {
  color: var(--violet);
  background: var(--violet);
}

.pulse-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.energy-list,
.user-orbit-list,
.registry-table,
.radar-stack {
  display: grid;
  gap: 12px;
}

.energy-label,
.user-orbit-row,
.registry-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.energy-label span,
.user-orbit-row strong,
.registry-row span {
  color: var(--text-strong);
  font-weight: 800;
}

.energy-label b,
.user-orbit-row b,
.registry-row b {
  color: var(--accent-strong);
}

.energy-track,
.orbit-track {
  height: 9px;
  border: 1px solid rgba(122, 249, 238, 0.18);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.energy-track span,
.orbit-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #38a9ff, var(--violet));
  box-shadow: 0 0 18px rgba(32, 214, 199, 0.55);
}

.energy-row em,
.user-orbit-row span,
.registry-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.user-orbit-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-orbit-row > div:first-child {
  min-width: 150px;
  display: grid;
  gap: 3px;
}

.orbit-track {
  flex: 1;
}

.radar-stack {
  grid-template-columns: repeat(3, 1fr);
}

.radar-node {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.94) 0 51%, transparent 52%),
    conic-gradient(from 180deg, var(--accent-strong) var(--degree), rgba(125, 124, 255, 0.18) 0);
  box-shadow: 0 0 32px rgba(32, 214, 199, 0.2);
}

.radar-node span {
  font-size: 24px;
  font-weight: 900;
}

.radar-node em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.registry-row {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(122, 249, 238, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.script-layout {
  grid-template-columns: minmax(380px, 0.9fr) minmax(560px, 1.1fr);
}

.script-result-grid {
  display: grid;
  gap: 14px;
}

.script-empty,
.script-card {
  border: 1px solid rgba(122, 249, 238, 0.15);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.075), rgba(125, 124, 255, 0.075)),
    rgba(4, 10, 18, 0.56);
  box-shadow: inset 0 0 28px rgba(122, 249, 238, 0.055);
}

.script-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.script-empty strong {
  color: var(--accent-strong);
  font-size: 20px;
}

.script-card {
  padding: 14px;
}

.script-card-main {
  min-height: 420px;
}

.script-logline {
  margin: 10px 0 12px;
  color: var(--accent-strong);
  font-weight: 800;
}

.script-text {
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dcecff;
  line-height: 1.75;
  border: 1px solid rgba(122, 249, 238, 0.12);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(rgba(122, 249, 238, 0.055) 1px, transparent 1px),
    rgba(0, 0, 0, 0.22);
  background-size: 100% 28px;
}

.script-asset-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.script-asset-group {
  display: grid;
  gap: 10px;
}

.script-asset-group h3 {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-strong);
}

.script-asset-group h3 span {
  color: var(--accent-strong);
}

.script-asset-item {
  padding: 10px;
  border: 1px solid rgba(122, 249, 238, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.script-asset-item strong {
  color: var(--accent-strong);
}

.script-asset-item p {
  margin: 7px 0;
  color: var(--muted);
  line-height: 1.55;
}

.script-asset-prompt {
  padding-top: 7px;
  border-top: 1px solid rgba(122, 249, 238, 0.1);
}

.script-asset-prompt span {
  display: block;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.script-asset-item em {
  color: var(--muted-2);
  font-size: 12px;
  font-style: normal;
}

.dashboard-hero-copy {
  max-width: 760px;
}

.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: end;
}

.dashboard-date-field {
  min-width: 178px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-date-input {
  min-height: 42px;
  color: var(--text-strong);
  border: 1px solid rgba(122, 249, 238, 0.32);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(3, 8, 14, 0.7);
  box-shadow: inset 0 0 22px rgba(32, 214, 199, 0.11), 0 0 18px rgba(32, 214, 199, 0.08);
}

.metric-card.violet,
.ops-dial.violet {
  --dial-color: var(--violet);
}

.metric-card.blue,
.ops-dial.blue {
  --dial-color: #38a9ff;
}

.metric-card.pink,
.ops-dial.pink {
  --dial-color: #ff5edb;
}

.metric-card.cyan,
.ops-dial.cyan,
.metric-card {
  --dial-color: var(--accent-strong);
}

.metric-ring {
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.96) 0 49%, transparent 50%),
    conic-gradient(from 210deg, var(--dial-color) calc(var(--level) * 1%), rgba(125, 124, 255, 0.18) 0);
}

.orbital-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(122, 249, 238, 0.12);
  background:
    radial-gradient(circle at 50% 34%, rgba(32, 214, 199, 0.16), transparent 38%),
    linear-gradient(rgba(122, 249, 238, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 249, 238, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.02);
  background-size: auto, 100% 26px, 26px 100%, auto;
}

.orbital-day,
.ops-dial,
.operator-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(122, 249, 238, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(32, 214, 199, 0.08), rgba(125, 124, 255, 0.07)),
    rgba(6, 12, 21, 0.72);
  box-shadow: inset 0 0 28px rgba(122, 249, 238, 0.08), 0 18px 34px rgba(0, 0, 0, 0.18);
}

.orbital-day {
  min-height: 156px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
}

.orbital-day-ring,
.ops-dial-ring,
.operator-orb {
  position: relative;
  width: 82px;
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.98) 0 48%, transparent 49%),
    conic-gradient(from 210deg, var(--accent-strong) calc(var(--level) * 1%), rgba(125, 124, 255, 0.16) 0);
  box-shadow: 0 0 24px rgba(32, 214, 199, 0.28), inset 0 0 20px rgba(122, 249, 238, 0.08);
}

.orbital-day-ring::before,
.ops-dial-ring::before,
.operator-orb::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  border: 1px dashed rgba(122, 249, 238, 0.22);
  animation: dialSpin 14s linear infinite;
}

.orbital-day-ring::after,
.ops-dial-ring::after,
.operator-orb::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 16px rgba(125, 124, 255, 0.18);
}

.orbital-day-ring strong,
.ops-dial-ring strong,
.operator-orb span {
  color: #ffffff;
  font-size: 20px;
  font-weight: 950;
}

.orbital-day-ring span,
.ops-dial-ring span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.orbital-day b,
.ops-dial b,
.operator-card strong {
  color: var(--text-strong);
  font-weight: 900;
  text-align: center;
}

.orbital-day em,
.ops-dial em,
.operator-card em,
.operator-card small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: center;
}

.ops-dial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 12px;
}

.ops-dial {
  min-height: 174px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 14px 10px;
}

.ops-dial-ring {
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.98) 0 48%, transparent 49%),
    conic-gradient(from 210deg, var(--dial-color) calc(var(--level) * 1%), rgba(125, 124, 255, 0.16) 0);
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.operator-card {
  min-height: 184px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  padding: 14px;
}

.operator-orb {
  background:
    radial-gradient(circle, rgba(7, 11, 18, 0.98) 0 48%, transparent 49%),
    conic-gradient(from 210deg, #38a9ff calc(var(--level) * 1%), rgba(255, 94, 219, 0.16) 0);
}

@keyframes dialSpin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-loading,
.dashboard-error {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: rgba(10, 17, 27, 0.8);
}

@keyframes scanline {
  to {
    transform: translateY(100%);
  }
}

.library-search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.search-submit-button,
.search-clear-button {
  flex: 0 0 auto;
}

.search-input-wrap {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.search-input-label {
  font-size: 12px;
  color: var(--muted);
}

.search-input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.search-input::placeholder {
  color: color-mix(in srgb, var(--muted) 85%, transparent);
}

.search-input:focus {
  outline: none;
  border-color: rgba(32, 214, 199, 0.5);
  box-shadow: 0 0 0 3px rgba(32, 214, 199, 0.14);
  background: rgba(255, 255, 255, 0.065);
}

.search-clear-button {
  white-space: nowrap;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), transparent 150px),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--inner-glow);
  padding: 18px;
  min-width: 0;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 249, 238, 0.62), transparent);
}

.output-panel {
  position: sticky;
  top: 20px;
  background:
    linear-gradient(180deg, rgba(32, 214, 199, 0.09), transparent 170px),
    var(--panel-2);
}

.section-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 15px;
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text-strong);
}

.section-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--amber-soft);
  border: 1px solid rgba(242, 184, 75, 0.3);
  color: #ffd791;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.segment {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 11px 8px;
  min-width: 0;
  transition: 140ms ease;
}

.segment:last-child {
  border-right: 0;
}

.segment:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.segment.active {
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.2), rgba(125, 124, 255, 0.12));
  color: var(--accent-strong);
  font-weight: 800;
}

.step-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.step-tab {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 8px 11px;
  transition: 140ms ease;
}

.step-tab:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.step-tab.active {
  background: rgba(32, 214, 199, 0.14);
  color: var(--accent-strong);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(32, 214, 199, 0.08);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.image-action-field {
  align-content: end;
}

.reference-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.reference-panel.is-disabled {
  opacity: 0.72;
}

.reference-upload-row,
.reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.reference-upload-row input[type="file"] {
  display: none;
}

.reference-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.04);
}

.reference-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.reference-chip span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-field {
  gap: 6px;
}

.image-edit-instruction {
  min-height: 58px;
}

.image-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--inner-glow);
}

.image-card img,
.library-image-thumb {
  width: 100%;
  display: block;
  background: rgba(255, 255, 255, 0.035);
}

.image-card img {
  max-height: min(68vh, 720px);
  object-fit: contain;
  border-bottom: 1px solid var(--line);
}

.image-card-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.library-image-thumb {
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.library-collapsible,
.image-record-summary {
  cursor: pointer;
}

.library-collapsible:focus,
.library-collapsible:focus-within,
.library-collapsible:hover,
.image-record-summary:focus-within,
.image-record-summary:hover {
  border-color: var(--line-strong);
}

.library-collapsible.is-expanded {
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.08), rgba(255, 255, 255, 0.035));
}

.compact-body {
  color: var(--muted);
}

.library-inline-detail {
  cursor: text;
  max-height: min(56vh, 620px);
  overflow: auto;
  border: 1px solid rgba(128, 225, 239, 0.12);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.image-record-body {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.image-detail-modal {
  width: min(980px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
}

.image-record-preview {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.image-prompt-detail {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}


.field {
  display: grid;
  gap: 8px;
}

.field > span,
.field-label {
  color: #d8e7f2;
  font-weight: 800;
  font-size: 14px;
}

.field-hint {
  color: var(--muted-2);
  font-size: 12px;
}

.split-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.char-counter {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.char-counter.over-limit,
.limit-warning {
  color: #ff8f8f;
}

.input-error {
  border-color: rgba(255, 143, 143, 0.72) !important;
  box-shadow: 0 0 0 1px rgba(255, 143, 143, 0.18), 0 0 24px rgba(255, 80, 80, 0.08);
}

.chapter-input {
  min-height: 230px;
  line-height: 1.72;
}

@media (max-width: 720px) {
  .chapter-input {
    min-height: 180px;
  }
}

.asset-search-box {
  border: 1px solid rgba(122, 249, 238, 0.14);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.asset-choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-search-row {
  display: flex;
  gap: 8px;
}

.asset-search-row .input {
  flex: 1;
}

.asset-search-clear {
  width: auto;
  white-space: nowrap;
}

.choice-meta {
  color: var(--muted-2);
  font-size: 12px;
}

.section-divider {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 10, 17, 0.72);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  box-shadow: var(--inner-glow);
}

textarea {
  resize: vertical;
  min-height: 86px;
  line-height: 1.62;
}

select option {
  color: #172026;
  background: #ffffff;
}

.input::placeholder,
textarea::placeholder {
  color: #5f768c;
}

.input:focus,
textarea:focus,
select:focus {
  border-color: rgba(122, 249, 238, 0.82);
  box-shadow: 0 0 0 3px rgba(32, 214, 199, 0.14), var(--inner-glow);
}

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-expand-row {
  display: flex;
  margin-top: 8px;
}

.option-expand-toggle {
  font-size: 12px;
  padding: 6px 10px;
}

.choice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: #c7d7e4;
  padding: 8px 10px;
  min-height: 36px;
  max-width: 100%;
  transition: 140ms ease;
}

.choice:hover {
  border-color: var(--line-strong);
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.07);
}

.choice.selected {
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.2), rgba(125, 124, 255, 0.16));
  color: var(--accent-strong);
  border-color: rgba(122, 249, 238, 0.62);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(32, 214, 199, 0.1);
}

.custom-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.custom-line .input {
  flex: 1;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.12), rgba(125, 124, 255, 0.07)),
    rgba(255, 255, 255, 0.035);
  margin-bottom: 14px;
}

.info-box {
  border: 1px solid rgba(125, 124, 255, 0.2);
  border-radius: var(--radius);
  padding: 12px 13px;
  background:
    linear-gradient(135deg, rgba(125, 124, 255, 0.11), rgba(32, 214, 199, 0.06)),
    rgba(255, 255, 255, 0.028);
  margin-bottom: 14px;
}

.info-box p {
  margin: 0;
  color: #c5d5e1;
  line-height: 1.62;
  font-size: 13px;
}

.summary-label {
  color: var(--accent-strong);
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 800;
}

.summary-box p {
  margin: 0;
  line-height: 1.65;
  color: #dcebf5;
}

.compact-field {
  margin-bottom: 14px;
}

.prompt-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.prompt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #d8e7f2;
  font-weight: 800;
  font-size: 14px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.028);
}

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  display: grid;
  gap: 8px;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.item-title {
  font-weight: 850;
  color: var(--text-strong);
}

.item-meta {
  color: var(--muted);
  font-size: 12px;
}

.item-body {
  color: #c3d3df;
  line-height: 1.6;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.shot-draft-list {
  margin-top: 4px;
}

.shot-draft {
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.09), rgba(125, 124, 255, 0.045)),
    rgba(255, 255, 255, 0.025);
}


.shot-draft.collapsed {
  cursor: pointer;
}

.shot-draft.collapsed:hover {
  border-color: rgba(32, 214, 199, 0.4);
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.13), rgba(125, 124, 255, 0.06)),
    rgba(255, 255, 255, 0.03);
}

.shot-draft.expanded {
  cursor: pointer;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  border-radius: 999px;
  background: rgba(32, 214, 199, 0.11);
  border: 1px solid rgba(32, 214, 199, 0.2);
  color: var(--accent-strong);
  font-size: 12px;
  padding: 4px 8px;
}

body:not(.is-authenticated) #app,
body.is-auth-checking #app,
body.is-auth-checking .login-screen {
  display: none;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

body:not(.is-auth-checking) .boot-screen {
  display: none;
}

.boot-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: rgba(9, 15, 24, 0.78);
  box-shadow: var(--shadow), var(--inner-glow);
  backdrop-filter: blur(18px);
}

.boot-mark {
  flex: 0 0 auto;
}

.boot-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.boot-title {
  margin-top: 4px;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 800;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 18% 18%, rgba(32, 214, 199, 0.18), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(125, 124, 255, 0.18), transparent 30%),
    radial-gradient(circle at 50% 88%, rgba(242, 184, 75, 0.08), transparent 28%);
  filter: blur(2px);
  pointer-events: none;
}

body.is-authenticated .login-screen {
  display: none;
}

.login-shell {
  width: min(1120px, 100%);
  min-height: 660px;
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
  position: relative;
  z-index: 1;
}

.login-card,
.login-visual {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: rgba(9, 15, 24, 0.78);
  box-shadow: var(--shadow), var(--inner-glow);
  overflow: hidden;
}

.login-card {
  position: relative;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  backdrop-filter: blur(18px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--violet), transparent);
}

.login-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.login-mark {
  flex: 0 0 auto;
}

.login-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 4px 0 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  color: var(--text-strong);
}

.login-lead {
  margin: 0;
  color: #c7d8e6;
  line-height: 1.78;
  max-width: 420px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-submit {
  min-height: 44px;
  margin-top: 4px;
}

.login-message {
  min-height: 22px;
  color: #ffd791;
  font-size: 13px;
  line-height: 1.55;
}

.login-message.success {
  color: var(--green);
}

.login-message.error {
  color: #ff9db4;
}

.login-config-hint {
  border: 1px solid rgba(125, 124, 255, 0.22);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  line-height: 1.7;
}

.login-config-hint code {
  color: var(--accent-strong);
}

.login-visual {
  position: relative;
  min-height: 520px;
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.12), rgba(125, 124, 255, 0.1)),
    #070b12;
}

.login-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.9;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 11, 18, 0.45), transparent 42%),
    linear-gradient(0deg, rgba(7, 11, 18, 0.64), transparent 42%);
}

.login-visual-overlay {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-visual-overlay span,
.auth-user-badge {
  backdrop-filter: blur(12px);
}

.login-visual-overlay span {
  border: 1px solid rgba(122, 249, 238, 0.26);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(5, 10, 17, 0.52);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.auth-user-badge {
  align-self: center;
  background: rgba(32, 214, 199, 0.11);
  border-color: rgba(32, 214, 199, 0.28);
  color: var(--accent-strong);
}

.danger-button {
  background: linear-gradient(135deg, #ff7d90, #ffb14f);
  color: #18050c;
}

.library-delete {
  border-color: rgba(255, 111, 145, 0.28);
  color: #ffc3d0;
}

.library-delete:hover {
  border-color: rgba(255, 111, 145, 0.56);
  background: rgba(255, 111, 145, 0.12);
  color: #ffe3ea;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 7, 12, 0.72);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  border-radius: calc(var(--radius) + 8px);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 160px),
    rgba(8, 13, 21, 0.96);
  box-shadow: var(--shadow), var(--inner-glow);
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.modal-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
  color: var(--text-strong);
}

.modal-body {
  margin: 14px 0 0;
  color: #c7d8e6;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: var(--radius);
  background: #101a27;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  #app {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .split-layout,
  #imageView .split-layout,
  .library-grid,
  .form-two-col,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .output-panel {
    position: static;
  }

  .login-shell {
    min-height: auto;
  }

  .login-visual {
    min-height: 360px;
    order: -1;
  }
}

@media (max-width: 760px) {
  #app {
    display: block;
  }

  .login-screen {
    padding: 14px;
  }

  .login-shell {
    gap: 14px;
  }

  .login-card {
    padding: 20px;
    gap: 18px;
  }

  .login-lead {
    max-width: none;
  }

  .login-visual {
    min-height: 240px;
  }

  .login-visual-overlay {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .library-grid {
    gap: 12px;
  }

  .library-grid .panel {
    padding: 12px;
  }

  .library-grid .section-header {
    margin-bottom: 10px;
  }

  .library-grid .section-header p {
    display: none;
  }

  .image-card img {
    max-height: 72vh;
  }

  .topbar {
    display: grid;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .top-actions,
  .button-row,
  .custom-line,
  .modal-actions,
  .item-actions,
  .library-search-row,
  .asset-search-row,
  .asset-choice-head {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .library-grid .item-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-grid .item-actions .library-delete {
    grid-column: 1 / -1;
  }

  .library-inline-detail {
    max-height: 46vh;
  }

  .library-search-summary {
    text-align: left;
  }

  .search-submit-button,
  .search-clear-button,
  .asset-search-clear {
    min-height: 44px;
  }

  .primary-button,
  .ghost-button,
  .mini-button,
  .auth-user-badge {
    width: 100%;
  }

  .modal-card {
    padding: 16px;
  }

  .modal-head {
    display: grid;
  }

  .auth-user-badge {
    justify-content: center;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segment {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segment:last-child {
    border-bottom: 0;
  }
}


.full-span {
  grid-column: 1 / -1;
}

.compact-row {
  margin-top: 10px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.035);
  color: #cbdbe7;
  font-size: 13px;
}

.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.video-task-card {
  border: 1px solid rgba(32, 214, 199, 0.24);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(32, 214, 199, 0.1), rgba(125, 124, 255, 0.06)),
    rgba(255, 255, 255, 0.035);
  display: grid;
  gap: 10px;
}

.video-result-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-empty {
  padding: 12px;
}


/* Video generation redesign */
.video-generation-layout { align-items: start; }
.video-create-form { gap: 18px; }
.video-workflow-hint p { margin-bottom: 0; }
.video-upload-zone {
  display: grid; gap: 8px; place-items: center; min-height: 142px; padding: 22px;
  border: 1px dashed rgba(126, 201, 255, 0.45); border-radius: 20px;
  background: linear-gradient(135deg, rgba(78, 169, 255, 0.10), rgba(255, 132, 183, 0.07));
  color: var(--text); text-align: center; cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.video-upload-zone:hover {
  border-color: rgba(126, 201, 255, 0.85); transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(78, 169, 255, 0.16), rgba(255, 132, 183, 0.11));
}
.video-file-input { display: none; }
.upload-plus {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 999px;
  background: rgba(126, 201, 255, 0.16); border: 1px solid rgba(126, 201, 255, 0.36);
  font-size: 30px; line-height: 1;
}
.video-upload-zone small { color: var(--muted); max-width: 560px; }
.video-media-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.video-media-card, .video-result-card {
  overflow: hidden; border: 1px solid rgba(126, 201, 255, 0.16); border-radius: 18px;
  background: rgba(7, 13, 21, 0.36);
}
.video-media-preview { aspect-ratio: 16 / 9; background: rgba(255,255,255,0.04); display: grid; place-items: center; }
.video-media-preview img, .video-media-preview video { width: 100%; height: 100%; object-fit: cover; }
.audio-thumb, .video-pending-box {
  min-height: 150px; display: grid; place-items: center; color: var(--muted);
  background: radial-gradient(circle at top left, rgba(126, 201, 255, 0.18), rgba(255,255,255,0.03));
}
.video-media-body { display: grid; gap: 8px; padding: 12px; }
.video-media-role {
  width: 100%; border: 1px solid rgba(126, 201, 255, 0.18); border-radius: 12px;
  background: rgba(4, 10, 18, 0.7); color: var(--text); padding: 8px 10px;
}
.video-main-prompt textarea { min-height: 210px; font-size: 15px; line-height: 1.7; }
.simple-video-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.form-three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.advanced-video-settings {
  border: 1px solid rgba(126, 201, 255, 0.14); border-radius: 18px; padding: 14px;
  background: rgba(255,255,255,0.025);
}
.advanced-video-settings summary, .prompt-debug-panel summary { cursor: pointer; color: var(--text); font-weight: 700; }
.compact-advanced-grid { margin-top: 14px; }
.video-result-grid { display: grid; gap: 14px; }
.video-preview-box { background: rgba(3, 8, 14, 0.72); }
.generated-video { width: 100%; max-height: 520px; display: block; background: #000; }
.prompt-debug-panel { margin-top: 16px; border-top: 1px solid rgba(126, 201, 255, 0.14); padding-top: 14px; }
@media (max-width: 920px) { .form-three-col { grid-template-columns: 1fr; } }

@media (max-width: 1180px) {
  .dashboard-metrics,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .dashboard-hero,
  .metric-card {
    flex-direction: column;
  }
  .dashboard-metrics,
  .dashboard-grid,
  .script-layout,
  .radar-stack,
  .orbital-week {
    grid-template-columns: 1fr;
  }
  .script-asset-columns {
    grid-template-columns: 1fr;
  }
  .dashboard-wide {
    grid-column: span 1;
  }
  .dashboard-controls {
    justify-content: stretch;
  }
  .dashboard-controls > * {
    flex: 1 1 100%;
  }
  .sidebar-logo {
    width: 100%;
  }
  .login-logo,
  .boot-logo {
    width: min(300px, 100%);
  }
}


/* Reusable video reference map */
.reference-map-panel,
.shot-reference-panel,
.temporary-reference-panel {
  border: 1px solid rgba(126, 201, 255, 0.12);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.018);
}
.compact-upload-zone {
  min-height: 104px;
  padding: 16px;
}
.video-reference-table {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.video-reference-row {
  display: grid;
  grid-template-columns: auto 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(126, 201, 255, 0.14);
  border-radius: 16px;
  background: rgba(5, 12, 20, 0.42);
}
.reference-code-pill {
  min-width: 48px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(126, 201, 255, 0.14);
  color: var(--text);
  font-weight: 800;
  text-align: center;
}
.reference-thumb {
  width: 76px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 12px;
}
.reference-thumb img,
.reference-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reference-edit-fields {
  display: grid;
  grid-template-columns: 92px minmax(160px, 1fr) 140px;
  gap: 8px;
}
.reference-edit-fields select {
  border: 1px solid rgba(126, 201, 255, 0.18);
  border-radius: 12px;
  background: rgba(4, 10, 18, 0.7);
  color: var(--text);
  padding: 8px 10px;
}
.reference-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.reference-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.current-reference-title {
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .video-reference-row,
  .reference-edit-fields,
  .reference-code-row {
    grid-template-columns: 1fr;
  }
  .reference-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
}
