
:root {
  --bg: #f7f1ec;
  --ink: #fffdfb;
  --card: rgba(255, 253, 251, 0.92);
  --line: rgba(92, 62, 70, 0.12);
  --line-strong: rgba(92, 62, 70, 0.2);
  --text: #3c3034;
  --muted: #8d7380;
  --faint: #b39aa4;
  --accent: #e07a90;
  --accent-deep: #c45d76;
  --gold: #a67c52;
  --good: #3f9d72;
  --shadow: 0 16px 36px rgba(120, 72, 84, 0.08);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(920px 520px at 8% -10%, rgba(232, 176, 186, 0.45), transparent 58%),
    radial-gradient(780px 480px at 100% 100%, rgba(236, 214, 186, 0.72), transparent 55%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
input { outline: none; }
::selection { background: rgba(224, 122, 144, 0.28); }

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.75;
}

.g1 { left: -8vw; top: -12vw; background: rgba(244, 196, 206, 0.9); }
.g2 { right: -12vw; bottom: -16vw; background: rgba(236, 214, 186, 0.95); }

#app { position: relative; z-index: 1; min-height: 100dvh; }

.gate {
  min-height: 100dvh;
  width: min(440px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-content: center;
  padding: 32px 0;
}

.gate-copy { text-align: center; }

.gate-copy h1, .topbar h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.gate-card, .panel, .stat, .table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gate-card {
  border-radius: 28px;
  padding: 28px;
  animation: rise 0.45s var(--ease);
}

.gate-card h2 {
  margin: 0 0 24px;
  font-size: 24px;
}

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--muted); }

.field input, .search input, .note-input, .channel input {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
}

.secret { position: relative; }
.secret input { padding-right: 64px; }
.eye-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.eye-btn:hover, .text-btn:hover, .tiny:hover, .ghost:hover, .chip:hover, .nav-btn:hover { background: #fff5f7; }
.eye-btn svg { width: 18px; height: 18px; display: block; margin: 0 auto; }

.help { min-height: 20px; margin: 0 0 8px; color: var(--accent-deep); font-size: 13px; }

.primary, .ghost, .tiny, .text-btn, .chip, .nav-btn, .switch, .tone {
  border: 0;
  background: transparent;
}

.primary {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(180deg, #ee8ea3, #d86d86);
  box-shadow: 0 10px 22px rgba(224, 122, 144, 0.28);
}
.primary:hover { filter: brightness(1.04); }
.primary:active { transform: translateY(1px); }
.primary.danger { background: linear-gradient(180deg, #d46b7e, #a94b5c); }
.primary.inline { width: auto; padding: 0 18px; }

.ghost, .tiny {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.tiny { height: 32px; padding: 0 10px; border-radius: 999px; font-size: 12px; }
.tiny.danger { color: #a94b5c; }

.fine { margin: 14px 0 0; color: var(--faint); font-size: 12px; line-height: 1.6; }

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

.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 16px;
  background: rgba(255, 253, 251, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand strong { display: block; font-size: 18px; }
.brand small { color: var(--muted); }

.logo {
  display: block;
  width: 42px;
  height: 42px;
  flex: none;
}
.gate-copy .logo { width: 48px; height: 48px; margin: 0 auto 16px; }

.side nav { display: grid; gap: 4px; }
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  text-align: left;
  color: var(--text);
}
.nav-btn svg { width: 18px; height: 18px; color: var(--muted); }
.nav-btn.active { background: #fff1f4; color: var(--accent-deep); font-weight: 700; }
.nav-btn.active svg { color: var(--accent-deep); }

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 12px;
}
.side-link, .text-btn {
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
}
.who { padding: 0 10px; color: var(--faint); font-size: 12px; }

main { padding: 28px 32px 56px; min-width: 0; }
.stage { max-width: 1180px; animation: rise 0.4s var(--ease); }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.topbar h1 { font-size: 32px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { border-radius: 22px; padding: 18px; transition: transform 0.25s var(--ease); }
.stat:hover { transform: translateY(-2px); }
.stat span, .stat em { color: var(--muted); font-size: 13px; font-style: normal; }
.stat em { display: block; margin-top: 8px; color: var(--faint); font-size: 12px; }
.stat b {
  display: block;
  margin-top: 8px;
  font-family: Manrope, sans-serif;
  font-size: 34px;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.split, .pay-layout { display: grid; grid-template-columns: 1.45fr 0.85fr; gap: 14px; margin-top: 14px; }
.pay-layout { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
.panel { border-radius: 22px; padding: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 16px; }
.panel .hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.chip.active { background: #fff1f4; color: var(--accent-deep); border-color: transparent; font-weight: 700; }
.search { display: flex; align-items: center; min-width: min(280px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; }
.search input { border: 0; background: transparent; height: 42px; }

.table-wrap { overflow: auto; border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: #fbf7f4; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fff8f8; }
.mono { font-family: Manrope, sans-serif; font-weight: 700; letter-spacing: 0.04em; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.muted { color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f4eef2;
  color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { background: #e7f6ee; color: #2f8d64; }
.pill.expired { background: #f8efe3; color: #a67c52; }
.pill.off { background: #fdecef; color: #c45d76; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed li, .channel {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.feed small, .channel small { display: block; color: var(--muted); font-size: 12px; }
.feed strong { font-family: Manrope, sans-serif; }

.inline-form { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
.note-input { height: 36px; border-radius: 10px; }

.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); padding: 0; }
.switch i {
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: #eadfe3;
  position: relative;
  transition: background 0.2s var(--ease);
}
.switch i::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 2px 6px rgba(80, 40, 50, 0.16);
}
.switch[aria-pressed="true"] { color: var(--accent-deep); }
.switch[aria-pressed="true"] i { background: linear-gradient(90deg, #eea0b2, #e07a90); }
.switch[aria-pressed="true"] i::after { transform: translateX(16px); }

.channels { display: grid; gap: 10px; }
.channel { display: grid; gap: 10px; }
.channel-top, .channel-grid { display: flex; align-items: center; gap: 8px; }
.channel-grid { display: grid; grid-template-columns: 1fr 1.4fr auto; }
.channel input { height: 42px; }
.tone {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line-strong);
  flex: none;
}
.tone-mint { background: #7dcead; }
.tone-sky { background: #8eb7e8; }
.tone-gold { background: #e0b56a; }
.tone-violet { background: #c0aae6; }
.tone-coral { background: #e07a90; }
.sort-no { font-family: Manrope, sans-serif; color: var(--faint); font-size: 12px; }

.price-field { display: flex; align-items: baseline; gap: 4px; margin: 10px 0 6px; }
.price-field span { font-family: Manrope, sans-serif; font-size: 28px; color: var(--accent-deep); }
.price-field input {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: Manrope, sans-serif;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.05em;
  height: 72px;
  padding: 0;
}
.preview {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7f4;
  color: var(--gold);
  font-size: 13px;
  line-height: 1.5;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; }

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(60, 48, 52, 0.28);
}
.modal-back[hidden] { display: none; }
.modal {
  width: min(420px, 100%);
  background: #fffdfb;
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: rise 0.28s var(--ease);
}
.modal h3 { margin: 0; font-size: 20px; }
.modal p { color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .primary { width: auto; padding: 0 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  background: #3c3034;
  color: #fffdfb;
  border-radius: 999px;
  padding: 12px 16px;
  transition: 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.icon-btn:focus-visible, .primary:focus-visible, .ghost:focus-visible, .tiny:focus-visible, .text-btn:focus-visible, .nav-btn:focus-visible, .chip:focus-visible, .switch:focus-visible, input:focus-visible {
  outline: 2px solid rgba(224, 122, 144, 0.75);
  outline-offset: 2px;
}

.shake { animation: shake 0.36s var(--ease); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes shake {
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@media (max-width: 980px) {
  .gate, .shell, .stats, .split, .pay-layout, .inline-form, .channel-grid { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; overflow: auto; }
  .nav-btn { width: auto; white-space: nowrap; }
  .side-foot { grid-template-columns: 1fr 1fr; }
  main { padding: 20px 16px 40px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .gate-copy h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.tone-name { color: var(--muted); font-size: 12px; }

.inline-form input {
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
}

.note-input { width: 180px; }

.secret-box { display: grid; gap: 8px; margin: 0 0 12px; }
.secret-box span { font-size: 13px; color: var(--muted); }
.secret-box input, .secret-box textarea, .secret-box select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.secret-box textarea {
  min-height: 148px;
  resize: vertical;
  font-family: Consolas, ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
}
.pay-layout .switch { margin: 8px 0 12px; }
.page-controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:16px; margin:22px 0; color:var(--muted); font-size:13px; }
.stat > strong { display:block; margin-top:12px; font-size:16px; }
.order-id { display:block; color:var(--muted); font-size:11px; margin:5px 0; overflow-wrap:anywhere; }
.wrap-id { max-width:260px; white-space:normal; overflow-wrap:anywhere; }
.detail-grid { display:grid; grid-template-columns:100px minmax(0,1fr); gap:12px; font-size:13px; }
.detail-grid dt { color:var(--muted); }
.detail-grid dd { margin:0; overflow-wrap:anywhere; }
.modal-wide { width:min(620px,100%); }
.modal { max-height:90dvh; overflow:auto; }
.narrow-panel { max-width:560px; }
.field textarea, .toolbar select { border:1px solid var(--line); border-radius:12px; padding:12px; background:#fff; font:inherit; width:100%; }
.field textarea { resize:vertical; }
.toolbar select { width:auto; max-width:100%; }
.confirm-line { display:flex; gap:10px; align-items:flex-start; margin:16px 0; font-size:13px; line-height:1.6; }
.confirm-line input { margin-top:4px; accent-color:#cc7890; }
#operationsResults > .panel { margin-top:18px; }
.alert-panel { border-color:#e8bc8d; background:#fffaf2; }
.shell main { min-width:0; }
@media(max-width:980px) { .side { min-width:0; } .side nav { max-width:calc(100vw - 48px); } }
