:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #64748b;
  --line: #d9e2ec;
  --panel: #ffffff;
  --soft: #f5f8fb;
  --nav: #111827;
  --teal: #0f766e;
  --cyan: #0891b2;
  --violet: #6d28d9;
  --amber: #b45309;
  --red: #b91c1c;
  --green: #15803d;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--soft);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: var(--nav);
  color: #f8fafc;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f766e, #6d28d9);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
}

.brand-subtitle {
  color: #aeb9c8;
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dbeafe;
  background: transparent;
  border-radius: 8px;
  padding: 0 12px;
  text-align: left;
}

.nav-btn.active,
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #b6c2d2;
  font-size: 12px;
  line-height: 1.5;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 70px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-title {
  font-size: 22px;
  font-weight: 850;
}

.page-hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.content {
  padding: 26px 28px 42px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  background: #eef4f8;
}

.login-hero {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  background: #101827;
  color: #fff;
}

.hero-name {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  font-weight: 900;
  max-width: 560px;
}

.hero-copy {
  max-width: 560px;
  color: #d7dee9;
  font-size: 18px;
  line-height: 1.75;
}

.hero-screen {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 18px;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.07);
}

.mini-player {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.section-title {
  font-size: 20px;
  font-weight: 850;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.field {
  display: grid;
  gap: 7px;
}

.label {
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.14);
}

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

.btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #e2e8f0;
  color: #172033;
  font-weight: 750;
}

.btn.primary {
  background: var(--teal);
  color: #fff;
}

.btn.violet {
  background: var(--violet);
  color: #fff;
}

.btn.dark {
  background: #172033;
  color: #fff;
}

.btn.warn {
  background: #fff7ed;
  color: var(--amber);
  border: 1px solid #fed7aa;
}

.btn.danger {
  background: #fee2e2;
  color: var(--red);
}

.btn.icon {
  width: 40px;
  padding: 0;
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  padding: 18px;
}

.stat {
  display: grid;
  gap: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 30px;
  font-weight: 900;
}

.stat-note {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #334155;
  font-size: 12px;
  background: #f8fafc;
  white-space: nowrap;
}

td {
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

.tag.green {
  background: #dcfce7;
  color: #166534;
}

.tag.amber {
  background: #fef3c7;
  color: #92400e;
}

.tag.red {
  background: #fee2e2;
  color: #991b1b;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.toolbar .actions {
  justify-content: flex-end;
}

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

.template-card {
  min-height: 188px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.template-card h3,
.segment-card h3 {
  margin: 0;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.empty {
  padding: 38px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #bdc7d4;
  border-radius: 8px;
  background: #fff;
}

.split {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(420px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.form-section {
  display: grid;
  gap: 16px;
}

.segment-list {
  display: grid;
  gap: 12px;
}

.segment-card {
  display: grid;
  gap: 10px;
}

.segment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.display-page {
  min-height: 100vh;
  background: #0f172a;
  color: #fff;
  padding: clamp(14px, 2.4vw, 30px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  position: relative;
}

.display-exit {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 4;
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.display-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: clamp(14px, 2.4vw, 28px);
  align-items: stretch;
}

.visual-zone,
.subtitle-zone {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  min-height: 0;
}

.visual-zone {
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.assistant-figure {
  width: min(72vw, 330px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
}

.voice-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(34, 211, 238, 0.38);
  animation: pulse 2.2s infinite ease-in-out;
}

.voice-ring.two {
  width: 78%;
  height: 78%;
  border-color: rgba(167, 139, 250, 0.5);
  animation-delay: 0.45s;
}

.bot-face {
  width: 46%;
  aspect-ratio: 1;
  border-radius: 22%;
  background: #f8fafc;
  color: #0f172a;
  display: grid;
  place-items: center;
  font-size: 58px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
  animation: float 3.4s ease-in-out infinite;
}

.paused .voice-ring,
.paused .bot-face {
  animation-play-state: paused;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.48;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

.subtitle-zone {
  padding: clamp(18px, 2.4vw, 30px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.display-topic {
  display: grid;
  gap: 8px;
}

.display-topic .kb-name {
  color: #67e8f9;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 850;
}

.display-topic h1 {
  margin: 0;
  font-size: clamp(24px, 4.5vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.subtitle-text {
  overflow: auto;
  font-size: clamp(21px, 3.2vw, 42px);
  line-height: 1.42;
  font-weight: 800;
  color: #f8fafc;
}

.display-bottom {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: center;
}

.qr {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  display: grid;
  place-items: center;
}

.qr img,
.qr svg {
  width: 100%;
  height: 100%;
}

.cta {
  color: #fef3c7;
  font-size: clamp(20px, 2.8vw, 34px);
  line-height: 1.28;
  font-weight: 900;
}

.ticker {
  min-height: 46px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.ticker span {
  white-space: nowrap;
  padding-left: 100%;
  animation: ticker 22s linear infinite;
  color: #dff6ff;
  font-size: 18px;
  font-weight: 750;
}

@keyframes ticker {
  to {
    transform: translateX(-100%);
  }
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #dbe3ed;
  overflow: hidden;
}

.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  width: 0;
}

.control-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 7;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

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

  .nav-btn {
    justify-content: center;
    padding: 0 6px;
    font-size: 12px;
  }

  .sidebar-foot {
    display: none;
  }

  .grid.three,
  .grid.four,
  .split,
  .control-layout,
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 48vh;
    padding: 34px 24px;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 14px 16px;
    align-items: flex-start;
    gap: 12px;
  }

  .user-chip {
    display: none;
  }

  .content {
    padding: 18px 14px 30px;
  }

  .grid.two,
  .display-stage,
  .display-bottom {
    grid-template-columns: 1fr;
  }

  .display-bottom {
    justify-items: center;
    text-align: center;
  }

  .subtitle-zone {
    grid-template-rows: auto minmax(220px, 1fr) auto;
  }

  .visual-zone {
    min-height: 230px;
  }

  .nav {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, 1fr);
    grid-template-columns: none;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
