:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #162023;
  --muted: #68787d;
  --line: #d9e2e5;
  --primary: #176b87;
  --primary-ink: #ffffff;
  --accent: #d96c3b;
  --good: #1f8f61;
  --warn: #b87318;
  --dark: #172328;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  background: var(--dark);
  color: #e7eef0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f1b35b;
  color: #172328;
  font-weight: 800;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
  margin: 0;
}

.brand p,
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand p {
  color: #a9b7bb;
}

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

.nav-button,
.nav-link {
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  color: #d9e5e8;
  background: transparent;
  text-decoration: none;
}

.nav-button.active,
.nav-button:hover,
.nav-link:hover {
  background: #26383f;
  color: #ffffff;
}

.status-block {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #c9d6d9;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
}

.toast {
  position: fixed;
  right: 24px;
  top: 18px;
  z-index: 20;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #172328;
  color: #fff;
  box-shadow: 0 12px 30px rgba(20, 32, 37, .18);
}

.toast.show {
  display: block;
}

.toast.error {
  background: #8a3a1c;
}

.main {
  padding: 24px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.topbar h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary,
.ghost,
.quick-buttons button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.ghost,
.quick-buttons button {
  background: #e8eef0;
  color: #243136;
}

button.recording {
  background: var(--accent);
  color: #fff;
}

.test-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(360px, 1fr);
  gap: 20px;
  align-items: start;
}

.device,
.work-panel,
.table-wrap,
.api-grid,
.editor-form,
#stateEditor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.device {
  overflow: hidden;
  min-height: 620px;
}

.device-top {
  height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #10191d;
  color: #dce7ea;
  padding: 0 18px;
  font-size: 13px;
  letter-spacing: .06em;
}

.floor-display {
  display: grid;
  place-items: center;
  background: #20323a;
  color: #ffffff;
  min-height: 190px;
}

.floor-label {
  font-size: 14px;
  color: #b7c7cc;
}

.floor-display strong {
  font-size: 92px;
  line-height: 1;
}

.voice-panel {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.voice-panel span,
.section-heading span,
.api-grid label {
  color: var(--muted);
  font-size: 13px;
}

.voice-panel p {
  margin: 8px 0 0;
  min-height: 56px;
  font-size: 20px;
}

.result-strip {
  margin: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #edf3f5;
  color: #243136;
  min-height: 50px;
}

.result-strip.success {
  background: #dff2e9;
  color: #125a3c;
}

.result-strip.fail {
  background: #f7e9df;
  color: #8a3a1c;
}

.floor-grid {
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.floor-grid button {
  height: 58px;
  border-radius: 8px;
  background: #eff4f5;
  color: #172328;
  font-size: 18px;
  border: 1px solid var(--line);
}

.floor-grid button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.work-panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0;
  font-size: 18px;
}

.input-row,
.editor-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
}

.editor-form {
  padding: 14px;
  margin-bottom: 16px;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  min-height: 38px;
  background: #fff;
  color: var(--ink);
}

.checkbox-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.checkbox-line input {
  min-height: auto;
  width: 16px;
  height: 16px;
  padding: 0;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.engine-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf3f5;
  color: #243136;
  font-size: 13px;
  line-height: 1.45;
}

.engine-status.ready {
  background: #dff2e9;
  color: #125a3c;
}

.engine-status.warn {
  background: #f7e9df;
  color: #8a3a1c;
}

.wake-listener-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e8f4fd;
  color: #1a73e8;
  font-size: 13px;
}

.wake-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a73e8;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.import-guide {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #f6f8f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-guide div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.import-guide strong {
  color: var(--ink);
}

.import-guide pre {
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: #243136;
  font-size: 13px;
  line-height: 1.5;
}

.json-box {
  margin: 0;
  padding: 14px;
  min-height: 260px;
  overflow: auto;
  border-radius: 8px;
  background: #111b20;
  color: #d8f3ff;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

.floor-group {
  border-bottom: 1px solid var(--line);
}

.samples-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.floor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.floor-tab {
  padding: 8px 16px;
  background: rgba(23, 107, 135, 0.08);
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.floor-tab:hover {
  background: rgba(23, 107, 135, 0.15);
}

.floor-tab.active {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}

.samples-content {
  min-height: 60px;
}

.sample-table {
  width: 100%;
  border-collapse: collapse;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: #f8fbfb;
}

td button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: #f1e1d8;
  color: #8a3a1c;
}

.api-grid {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.api-grid div {
  display: grid;
  gap: 6px;
}

code {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: #111b20;
  color: #d8f3ff;
  overflow-x: auto;
}

#stateEditor {
  width: 100%;
  min-height: 420px;
  padding: 14px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
  resize: vertical;
}

.form-note {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.app-device-wrap {
  display: grid;
  grid-template-columns: minmax(420px, 720px) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.elevator-app {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 35, 43, .82), rgba(21, 70, 84, .52)),
    url("/app-bg.svg");
  background-size: cover;
  color: #fff;
  border: 1px solid #17313b;
}

.app-background {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .22), transparent 42%),
    radial-gradient(circle at 82% 52%, rgba(255, 255, 255, .14), transparent 34%);
  pointer-events: none;
}

.app-top,
.app-metrics,
.app-floor-list,
.app-current-floor,
.app-door-buttons,
.app-command-panel,
.app-result,
.app-radial-menu {
  position: relative;
  z-index: 1;
}

.app-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 28px 0;
}

.app-top strong {
  display: block;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0;
}

.app-top span {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: rgba(255, 255, 255, .84);
}

.app-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
}

.app-status span {
  margin-top: 0;
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
}

.app-status .sos-pill {
  background: #d94632;
  color: #fff;
  font-weight: 700;
}

.app-metrics {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin: 10px 28px 0;
  color: rgba(255, 255, 255, .9);
  font-size: 16px;
}

.app-radial-menu {
  position: absolute;
  right: -72px;
  top: 185px;
  width: 260px;
  height: 360px;
  border-radius: 180px 0 0 180px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(12, 27, 34, .48);
}

.app-radial-menu span,
.app-radial-menu button {
  position: absolute;
  color: rgba(255, 255, 255, .86);
}

.app-radial-menu span:nth-child(1) { left: 52px; top: 30px; }
.app-radial-menu span:nth-child(2) { left: 24px; top: 82px; }
.app-radial-menu span:nth-child(3) { left: 18px; top: 140px; }
.app-radial-menu span:nth-child(4) { left: 24px; top: 198px; }
.app-radial-menu span:nth-child(5) { left: 54px; top: 252px; }

.app-radial-menu button {
  left: 72px;
  top: 152px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  color: #fff;
}

.app-floor-list {
  position: absolute;
  left: 28px;
  bottom: 178px;
  display: grid;
  grid-template-columns: repeat(2, 118px);
  gap: 12px;
}

.app-floor-list button {
  height: 76px;
  border-radius: 8px;
  color: #fff;
  font-size: 34px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .32);
}

.app-floor-list button.active {
  background: rgba(217, 108, 59, .92);
  border-color: rgba(217, 108, 59, 1);
}

.app-current-floor {
  position: absolute;
  left: 34px;
  bottom: 94px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-current-floor .direction {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .36);
  background: rgba(255, 255, 255, .14);
}

.app-current-floor strong {
  font-size: 76px;
  line-height: 1;
}

.wake {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.voice-wave {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .75);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .16);
}

.app-command-panel {
  position: absolute;
  left: 310px;
  right: 28px;
  bottom: 112px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.app-command-panel input,
.app-command-panel button {
  border-color: rgba(255, 255, 255, .28);
}

.app-command-panel input {
  background: rgba(255, 255, 255, .92);
}

.app-command-panel button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.app-result {
  position: absolute;
  left: 310px;
  right: 28px;
  bottom: 64px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(13, 27, 34, .56);
  color: rgba(255, 255, 255, .92);
}

.app-result.success {
  background: rgba(31, 143, 97, .78);
}

.app-result.fail {
  background: rgba(138, 58, 28, .78);
}

.app-door-buttons {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.app-door-buttons button {
  height: 52px;
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32);
}

.app-door-buttons button.active {
  background: var(--accent);
}

.dialogue-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 460px);
  gap: 20px;
  align-items: start;
}

.dialogue-panel,
.dialogue-debug {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.dialogue-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dialogue-status div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f6f8f8;
}

.dialogue-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dialogue-status strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.dialogue-messages {
  height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.dialogue-message {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e8eef0;
}

.dialogue-message.user {
  margin-left: auto;
  background: var(--primary);
  color: var(--primary-ink);
}

.dialogue-message.agent {
  background: #edf3f5;
}

.dialogue-message.fail {
  background: #f7e9df;
  color: #8a3a1c;
}

.dialogue-message span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  opacity: .72;
}

.dialogue-message p {
  margin: 0;
  line-height: 1.5;
}

.dialogue-input {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  margin-top: 12px;
}

.dialogue-debug h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-header .close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-header .close:hover {
  color: var(--ink);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  margin: 0 0 16px 0;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.alias-loading {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.alias-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alias-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.alias-chip:hover {
  border-color: var(--primary);
}

.alias-chip.selected {
  background: rgba(23, 107, 135, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

.alias-chip input {
  display: none;
}

.alias-chip.error {
  color: var(--accent);
}

.alias-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  align-items: flex-start;
}

.alias-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(23, 107, 135, 0.08);
  border: 1px solid rgba(23, 107, 135, 0.2);
  border-radius: 12px;
  font-size: 13px;
  color: var(--primary);
}

.alias-more {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(184, 115, 24, 0.08);
  border: 1px solid rgba(184, 115, 24, 0.2);
  border-radius: 12px;
  font-size: 13px;
  color: var(--warn);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.alias-more:hover {
  background: rgba(184, 115, 24, 0.15);
}

.keywords-section {
  background: rgba(23, 107, 135, 0.04);
  border: 1px solid rgba(23, 107, 135, 0.12);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.keywords-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.keywords-row:last-child {
  margin-bottom: 0;
}

.keywords-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  min-width: 50px;
}

.keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(23, 107, 135, 0.08);
  border: 1px solid rgba(23, 107, 135, 0.2);
  border-radius: 12px;
  font-size: 13px;
  color: var(--primary);
  transition: all 0.2s;
}

.keyword-tag:hover {
  background: rgba(23, 107, 135, 0.15);
}

.keyword-tag.learned {
  background: rgba(23, 135, 73, 0.08);
  border-color: rgba(23, 135, 73, 0.2);
  color: #178749;
}

.keyword-tag.learned:hover {
  background: rgba(23, 135, 73, 0.15);
}

.keywords-hint {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.keyword-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: rgba(23, 107, 135, 0.08);
  border: 1px solid rgba(23, 107, 135, 0.2);
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.keyword-add:hover {
  background: rgba(23, 107, 135, 0.15);
  transform: scale(1.1);
}

.keyword-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 4px;
  background: rgba(220, 53, 69, 0.08);
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: bold;
  color: #dc3545;
  cursor: pointer;
  transition: all 0.2s;
}

.keyword-delete:hover {
  background: rgba(220, 53, 69, 0.15);
  transform: scale(1.1);
}

.learn-confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.learn-confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.learn-confirm-content {
  position: relative;
  width: 90%;
  max-width: 480px;
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.learn-confirm-content h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.learn-confirm-content p {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.learn-confirm-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.learn-confirm-category {
  padding: 14px 12px;
  background: rgba(23, 107, 135, 0.06);
  border: 1px solid rgba(23, 107, 135, 0.15);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.learn-confirm-category:hover {
  background: rgba(23, 107, 135, 0.12);
  border-color: rgba(23, 107, 135, 0.3);
  transform: translateY(-2px);
}

.learn-confirm-category:active {
  transform: translateY(0);
}

.learn-confirm-footer {
  display: flex;
  justify-content: flex-end;
}

.learn-confirm-skip {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.learn-confirm-skip:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.source-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.source-default {
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
}

.source-learned {
  background: rgba(23, 107, 135, 0.1);
  color: var(--primary);
}

.source-expanded {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.import-preview-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.import-preview-content {
  position: relative;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s ease-out;
  overflow-y: auto;
}

.import-preview-content h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.preview-stat {
  text-align: center;
  padding: 12px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
}

.preview-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.preview-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.preview-stat-success .preview-stat-value {
  color: #28a745;
}

.preview-stat-warning .preview-stat-value {
  color: #ffc107;
}

.preview-stat-error .preview-stat-value {
  color: #dc3545;
}

.preview-section {
  margin-bottom: 16px;
}

.preview-section h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.preview-category-list {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 8px;
}

.preview-category-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.preview-category-row:last-child {
  margin-bottom: 0;
}

.preview-category-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.preview-category-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.preview-category-count {
  font-size: 12px;
  color: #28a745;
}

.preview-category-duplicate {
  font-size: 12px;
  color: var(--muted);
}

.preview-skipped-list {
  background: rgba(220, 53, 69, 0.04);
  border-radius: 8px;
  padding: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.preview-skipped-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

.preview-skipped-item:last-child {
  margin-bottom: 0;
}

.preview-skipped-phrase {
  color: var(--text);
  flex: 1;
}

.preview-skipped-reason {
  color: #dc3545;
  margin-left: 12px;
}

.preview-skipped-more {
  text-align: center;
  padding: 4px;
  font-size: 12px;
  color: var(--muted);
}

.preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.preview-cancel {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.preview-cancel:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.preview-confirm {
  padding: 10px 24px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.preview-confirm:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.preview-confirm:disabled {
  background: rgba(23, 107, 135, 0.4);
  cursor: not-allowed;
}

.alias-tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 12px 16px;
  min-width: 200px;
  max-width: 400px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.alias-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tooltip-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tooltip-content {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alias-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* 导出版本样式 */
.export-versions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-version {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.export-version .version-info h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.export-version .version-info p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.export-btn {
  padding: 8px 16px;
}

.license-section {
  margin-top: 16px;
  padding: 16px;
  background: rgba(184, 115, 24, 0.08);
  border: 1px solid rgba(184, 115, 24, 0.2);
  border-radius: 8px;
}

.license-section p {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--warn);
}

.license-input {
  display: flex;
  gap: 8px;
}

.license-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}

.app-debug {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.app-debug h3 {
  margin: 0 0 14px;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.about-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
}

.about-card h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--primary);
}

.about-card p {
  margin: 0;
  line-height: 1.7;
  color: var(--ink);
}

.about-card ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.about-card li {
  margin-bottom: 4px;
}

.about-card li:last-child {
  margin-bottom: 0;
}

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

  .sidebar {
    position: static;
  }

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

  .test-layout,
  .app-device-wrap,
  .editor-form,
  .input-row {
    grid-template-columns: 1fr;
  }

  .elevator-app {
    min-height: 760px;
  }

  .app-command-panel,
  .app-result {
    left: 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
