:root {
  --bg: #f6f1eb;
  --bg-soft: #fffcf8;
  --panel: rgba(255, 252, 247, 0.82);
  --panel-strong: #ffffff;
  --panel-tint: #f5efe7;
  --text: rgba(29, 23, 18, 0.95);
  --muted: #726960;
  --muted-soft: #a79d92;
  --line: rgba(52, 41, 29, 0.1);
  --line-strong: rgba(52, 41, 29, 0.16);
  --accent: #0f8d64;
  --accent-deep: #0a6d4c;
  --accent-soft: rgba(15, 141, 100, 0.1);
  --accent-strong: rgba(15, 141, 100, 0.18);
  --warn: #9c4f39;
  --warn-soft: rgba(156, 79, 57, 0.1);
  --shadow-soft:
    0 20px 60px rgba(31, 22, 15, 0.05),
    0 8px 24px rgba(31, 22, 15, 0.04);
  --shadow-micro:
    0 1px 2px rgba(31, 22, 15, 0.04),
    0 10px 24px rgba(31, 22, 15, 0.03);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --font: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  padding: 24px;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(15, 141, 100, 0.1), transparent 30%),
    radial-gradient(circle at 85% 0%, rgba(231, 188, 126, 0.18), transparent 26%),
    linear-gradient(180deg, #fbf8f3 0%, #f3ede5 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.35)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 110px,
      rgba(69, 53, 34, 0.018) 111px,
      transparent 112px
    );
  opacity: 0.4;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1380px, 100%);
  margin: 0 auto;
}

.shell-admin {
  display: grid;
  gap: 24px;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(15, 141, 100, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 246, 240, 0.9));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
}

.topbar::before {
  top: -48px;
  right: -8px;
  width: 200px;
  height: 200px;
  background: rgba(15, 141, 100, 0.08);
}

.topbar::after {
  bottom: -80px;
  left: 32px;
  width: 220px;
  height: 220px;
  background: rgba(230, 185, 122, 0.12);
}

.brand-copy,
.action-row {
  position: relative;
  z-index: 1;
}

.brand-copy::before {
  content: "HM LIVE QR CONSOLE";
  display: inline-flex;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(52, 41, 29, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.brand-copy h1,
.public-title h1,
.login-card h1,
.editor-head h2,
.panel-head h2,
.subpanel h3,
.subpanel h4,
.empty-state h2 {
  margin: 0;
  font-family: var(--font-display);
}

.brand-copy h1,
.public-title h1 {
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.brand-copy p,
.public-title p,
.login-card p {
  margin: 12px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-height: 148px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(249, 245, 238, 0.92));
  box-shadow: var(--shadow-micro);
}

.metric-caption {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.app-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 24px;
  height: fit-content;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 243, 235, 0.9));
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(52, 41, 29, 0.08);
}

.panel-head h2,
.editor-head h2,
.subpanel h3,
.subpanel h4 {
  letter-spacing: -0.05em;
}

.livecode-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.livecode-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(31, 22, 15, 0.03);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.livecode-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-strong);
  box-shadow: 0 18px 34px rgba(31, 22, 15, 0.06);
}

.livecode-item.active {
  border-color: rgba(15, 141, 100, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 250, 246, 0.94));
}

.item-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.item-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(15, 141, 100, 0.14), rgba(15, 141, 100, 0.05));
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.item-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.item-title,
.item-meta,
.item-count {
  display: block;
}

.item-title {
  font-size: 15px;
  font-weight: 700;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.item-status.is-live {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.item-status.is-paused {
  background: var(--warn-soft);
  color: var(--warn);
}

.item-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-pills em,
.badge,
.login-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 141, 100, 0.08);
  color: var(--accent-deep);
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.item-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(52, 41, 29, 0.07);
}

.item-count strong {
  font-size: 22px;
  letter-spacing: -0.05em;
}

.item-count small {
  color: var(--muted);
}

.empty-list {
  padding: 18px;
  border-radius: 22px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  line-height: 1.7;
}

.empty-list p {
  margin: 0;
}

.empty-list p + p {
  margin-top: 6px;
}

.editor-area {
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 242, 235, 0.84));
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(52, 41, 29, 0.08);
}

.editor-head h2 {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.05;
}

.editor-head .muted-note {
  margin: 10px 0 0;
  max-width: 700px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  gap: 18px;
  margin-top: 20px;
}

.stack {
  display: grid;
  gap: 18px;
}

.subpanel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 244, 236, 0.9));
  box-shadow: var(--shadow-micro);
}

.subpanel h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.field.full {
  grid-column: 1 / -1;
}

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

.text-input,
.textarea,
.select,
.table-input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid rgba(52, 41, 29, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.text-input::placeholder,
.textarea::placeholder,
.table-input::placeholder {
  color: var(--muted-soft);
}

.text-input:focus,
.textarea:focus,
.select:focus,
.table-input:focus {
  border-color: rgba(15, 141, 100, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 141, 100, 0.08);
  transform: translateY(-1px);
}

.textarea {
  min-height: 106px;
  resize: vertical;
}

.switch-row,
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.switch-row {
  min-height: 52px;
  padding-inline: 4px;
}

.switch-row span {
  color: var(--text);
  font-weight: 500;
}

.switch-row input,
.inline-check input {
  accent-color: var(--accent);
}

.button,
.ghost-button,
.link-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 600;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.button:hover,
.ghost-button:hover,
.link-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.button {
  color: #ffffff;
  background: linear-gradient(180deg, #12966d 0%, #0a6d4c 100%);
  box-shadow: 0 14px 28px rgba(15, 141, 100, 0.18);
}

.button:hover {
  background: linear-gradient(180deg, #10916a 0%, #095f43 100%);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(52, 41, 29, 0.1);
  color: var(--text);
}

.ghost-button:hover {
  border-color: rgba(15, 141, 100, 0.2);
}

.link-button {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(52, 41, 29, 0.08);
  color: var(--muted);
}

.link-button:hover {
  color: var(--text);
  border-color: rgba(52, 41, 29, 0.14);
}

.danger-button {
  background: var(--warn-soft);
  border-color: rgba(156, 79, 57, 0.14);
  color: var(--warn);
}

.danger-button:hover {
  background: rgba(156, 79, 57, 0.14);
}

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

.target-toolbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
}

.target-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.target-table thead th {
  padding: 0 12px 6px;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.target-table tbody td {
  padding: 12px;
  vertical-align: top;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(52, 41, 29, 0.08);
  border-bottom: 1px solid rgba(52, 41, 29, 0.08);
}

.target-table tbody td:first-child {
  border-left: 1px solid rgba(52, 41, 29, 0.08);
  border-radius: 18px 0 0 18px;
}

.target-table tbody td:last-child {
  border-right: 1px solid rgba(52, 41, 29, 0.08);
  border-radius: 0 18px 18px 0;
}

.cell-small {
  width: 120px;
}

.cell-action {
  width: 96px;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.qr-frame,
.public-qr {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 340px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(52, 41, 29, 0.08);
  background:
    radial-gradient(circle at top left, rgba(15, 141, 100, 0.06), transparent 32%),
    linear-gradient(180deg, #fffdfa 0%, #f5efe7 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-micro);
}

.qr-frame::before,
.public-qr::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 24px;
  border: 1px dashed rgba(52, 41, 29, 0.06);
}

.public-qr img,
.qr-frame img {
  position: relative;
  z-index: 1;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
}

.muted-note,
.empty-line {
  color: var(--muted);
}

.stats-panel {
  display: grid;
  gap: 12px;
}

.stat-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(52, 41, 29, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.stat-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.stat-label strong {
  font-size: 15px;
}

.stat-label span {
  color: var(--muted);
}

.stat-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(52, 41, 29, 0.06);
  overflow: hidden;
}

.stat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #13956b, #62c5a1);
}

.scan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.scan-list li {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(52, 41, 29, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.scan-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.scan-head strong {
  font-size: 15px;
}

.scan-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.scan-meta small {
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(52, 41, 29, 0.07);
  background: rgba(248, 243, 236, 0.92);
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  border-radius: 30px;
  border: 1px dashed var(--line-strong);
  background:
    radial-gradient(circle at top, rgba(15, 141, 100, 0.06), transparent 28%),
    rgba(255, 255, 255, 0.56);
  color: var(--muted);
}

.empty-state h2 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.empty-state p {
  margin: 12px auto 0;
  max-width: 520px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(29, 23, 18, 0.92);
  color: #ffffff;
  box-shadow: 0 24px 48px rgba(29, 23, 18, 0.16);
}

.toast[data-kind="error"] {
  background: rgba(156, 79, 57, 0.96);
}

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.login-card {
  position: relative;
  width: min(500px, 100%);
  padding: 32px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(15, 141, 100, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 242, 235, 0.9));
}

.login-card::before {
  content: "Private Access";
  display: inline-flex;
  margin-bottom: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(52, 41, 29, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-top: 18px;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.helper {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.public-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.public-shell-minimal {
  width: min(560px, 100%);
  min-height: calc(100vh - 48px);
  justify-items: center;
  align-content: start;
  padding-top: min(6vh, 40px);
}

.public-card {
  padding: 20px;
}

.public-card-minimal {
  width: min(100%, 500px);
  padding: 20px 20px 28px;
  display: grid;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(circle at top, rgba(15, 141, 100, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 241, 232, 0.94));
}

.public-tip {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.06;
  letter-spacing: -0.06em;
}

.public-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.public-steps {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.public-qr-minimal {
  width: min(100%, 440px);
  border-radius: 34px;
}

.public-qr-minimal img {
  width: calc(100% - 24px);
  height: calc(100% - 24px);
}

@media (max-width: 1200px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-grid,
  .editor-grid,
  .public-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  .topbar,
  .editor-area,
  .sidebar,
  .subpanel,
  .login-card {
    padding: 20px;
  }

  .summary-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .editor-head,
  .target-toolbar,
  .panel-head,
  .scan-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-row,
  .public-actions {
    width: 100%;
  }

  .item-head {
    flex-wrap: wrap;
  }

  .item-status {
    order: 3;
  }

  .public-shell-minimal {
    min-height: calc(100vh - 32px);
    padding-top: 18px;
  }

  .public-card-minimal {
    padding: 18px 16px 22px;
  }

  .public-qr-minimal {
    width: min(100%, 360px);
  }

  .button,
  .ghost-button,
  .danger-button,
  .link-button {
    width: 100%;
  }

  .target-table thead {
    display: none;
  }

  .target-table,
  .target-table tbody,
  .target-table tr,
  .target-table td {
    display: block;
    width: 100%;
  }

  .target-table {
    border-spacing: 0;
  }

  .target-table tbody tr {
    margin-bottom: 12px;
  }

  .target-table tbody td {
    border-inline: 1px solid rgba(52, 41, 29, 0.08);
    border-bottom: none;
  }

  .target-table tbody td:first-child {
    border-radius: 18px 18px 0 0;
  }

  .target-table tbody td:last-child {
    border-bottom: 1px solid rgba(52, 41, 29, 0.08);
    border-radius: 0 0 18px 18px;
  }
}
