:root {
  --bg: #f6efe6;
  --bg-2: #f0e0d2;
  --surface: #ffffff;
  --ink: #251c17;
  --muted: #6e5b52;
  --accent: #c45e2e;
  --accent-2: #2f7a6d;
  --line: #e7d6c9;
  --shadow: 0 24px 50px rgba(44, 31, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, var(--bg), var(--bg-2));
}

#app {
  min-height: 100vh;
}

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

.sidebar {
  padding: 32px 24px;
  background: #201713;
  color: #f8eee6;
}

.logo {
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-size: 26px;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

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

.nav a {
  color: #f8eee6;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(4px);
}

.content {
  padding: 32px 36px 80px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header h1 {
  margin: 0;
  font-size: 28px;
}

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: rise 0.4s ease;
}

.card + .card {
  margin-top: 16px;
}

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

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.textarea {
  min-height: 140px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 13px;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

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

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(32, 23, 19, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.modal.open {
  display: flex;
}

.modal-content {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
}

.modal-tip {
  margin: 8px 0 18px;
  color: var(--muted);
}

#tele-qrcode {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.btn.primary {
  background: var(--accent);
}

.btn.secondary {
  background: var(--accent-2);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: #b64536;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f6ece3;
  color: #9a6f5b;
  font-size: 12px;
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.md-editor {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f8efe8;
}

.md-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.md-split .textarea {
  border: none;
  border-radius: 0;
  min-height: 260px;
  padding: 14px;
}

.markdown-preview {
  padding: 16px;
  border-left: 1px solid var(--line);
  min-height: 260px;
  background: #fbf7f3;
  overflow: auto;
}

.markdown-preview.markdown-body {
  font-family: "Noto Sans SC", "Montserrat", sans-serif;
  color: var(--ink);
}

.list-title {
  font-weight: 600;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.summary span {
  background: #f1e3d8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #6b5247;
}

.queue-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.queue-item.active {
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(196, 94, 46, 0.2);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  background: #201713;
  color: #fff;
  padding: 12px 16px;
  gap: 12px;
  justify-content: space-around;
}

.bottom-bar a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    display: none;
  }

  .content {
    padding: 20px 18px 90px;
  }

  .bottom-bar {
    display: flex;
  }

  .md-split {
    grid-template-columns: 1fr;
  }

  .markdown-preview {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}
