:root {
  --bg: #f7f8fd;
  --panel: rgba(255, 255, 255, .92);
  --text: #071a3d;
  --muted: #91a0bd;
  --primary: #7c3aed;
  --primary-dark: #641de4;
  --ok: #16c784;
  --border: #e6e8f3;
  --shadow: 0 24px 80px rgba(73, 43, 154, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: radial-gradient(circle at top, #fff 0%, var(--bg) 62%, #f0edff 100%); min-height: 100vh; }
.hidden { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
code { background: #f2f0ff; color: #5b21b6; padding: 2px 6px; border-radius: 8px; }

.exchange-shell { width: min(92vw, 560px); margin: 42px auto; }
.brand { text-align: center; margin-bottom: 26px; }
.brand h1 { margin: 0; font-size: clamp(34px, 7vw, 48px); letter-spacing: -1px; font-weight: 900; }
.brand p { margin: 6px 0 0; color: #9aa3bd; font-size: 13px; letter-spacing: 5px; font-weight: 700; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.exchange-panel { padding: 40px; position: relative; overflow: hidden; }
.exchange-panel::after { content: ""; position: absolute; right: 32px; top: 16px; width: 70px; height: 70px; background: #f6f6f8; clip-path: polygon(18% 0, 38% 24%, 57% 0, 78% 20%, 100% 16%, 92% 100%, 7% 80%, 0 18%); opacity: .9; z-index: 0; }
.exchange-panel > * { position: relative; z-index: 1; }
.status-pill { display: table; margin: 0 auto 22px; padding: 8px 22px; border-radius: 99px; background: #eafff5; color: #02a86b; font-size: 14px; font-weight: 800; }
.status-pill.muted { color: #64748b; background: #f1f5f9; }
.exchange-panel h2 { text-align: center; margin: 0; font-size: 28px; }
.sub { color: var(--muted); margin: 8px 0 24px; }
.exchange-panel .sub { text-align: center; }
.info-list { margin-top: 32px; display: grid; gap: 24px; }
.info-item span { display: block; font-size: 13px; color: #9ba7c2; letter-spacing: .8px; font-weight: 800; text-transform: uppercase; margin-bottom: 6px; }
.info-item strong { font-size: 18px; word-break: break-all; }
.code-text { color: var(--primary); font-size: 32px !important; letter-spacing: 9px; font-weight: 900; }
.code-item small { display: block; color: var(--muted); margin-top: 6px; }
.primary-btn, .secondary-btn, .ghost-btn { border: 0; border-radius: 16px; padding: 13px 22px; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; }
.primary-btn { background: linear-gradient(135deg, #8b3ff4, #6824dd); color: white; box-shadow: 0 12px 24px rgba(124, 58, 237, .25); }
.primary-btn:hover { background: linear-gradient(135deg, #7c35ec, #5d17d2); }
.secondary-btn { background: white; color: #73809d; border: 1px solid #dfe4f1; }
.ghost-btn { background: transparent; color: #73809d; border: 1px solid #dfe4f1; }
.wide { width: 100%; margin-top: 18px; }
.key-input-row { display: flex; gap: 12px; margin-top: 24px; }
.text-input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 14px; border: 1px solid #dfe4f1; outline: none; background: white; color: var(--text); }
.text-input:focus { border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(124, 58, 237, .08); }
.message { color: #64748b; min-height: 22px; }
.message.error { color: #dc2626; }
.message.ok { color: #059669; }

.admin-body { background: #f4f6fb; }
.admin-shell { width: min(96vw, 1240px); margin: 28px auto 60px; }
.admin-login { width: min(92vw, 430px); padding: 30px; margin: 10vh auto; display: grid; gap: 12px; }
.admin-login h1, .admin-header h1 { margin: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 18px; }
.admin-header p { color: var(--muted); margin: 6px 0 0; }
.header-actions, .small-row, .toolbar-controls, .pager { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: 1fr 1.2fr; }
.admin-shell .panel { padding: 24px; border-radius: 22px; box-shadow: 0 12px 30px rgba(30, 41, 59, .07); }
.panel h2 { margin: 0 0 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label { color: #60708e; font-size: 13px; font-weight: 700; }
.form-grid input { margin-top: 6px; }
.compact { width: 220px; }
.result-box { margin-top: 16px; display: grid; gap: 8px; }
.result-item { border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px; background: #fff; font-size: 13px; }
.result-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.result-item.error { border-color: #fecaca; background: #fff1f2; }
.table-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.table-wrap { overflow: auto; border: 1px solid #e5e7eb; border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; background: white; }
th, td { padding: 12px 10px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; font-size: 13px; }
th { color: #64748b; background: #f8fafc; font-size: 12px; letter-spacing: .4px; }
td strong { display: block; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.disabled { background: #fef3c7; color: #b45309; }
.badge.deleted { background: #fee2e2; color: #b91c1c; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { min-height: 32px; padding: 6px 10px; border-radius: 10px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.muted { color: var(--muted); }
.pager { justify-content: center; margin-top: 16px; }

@media (max-width: 860px) {
  .exchange-panel { padding: 30px 24px; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .admin-header, .table-toolbar { flex-direction: column; align-items: stretch; }
  .compact { width: 100%; }
  .key-input-row { flex-direction: column; }
}
