:root {
  color-scheme: light;
  --ink: #2a2025;
  --muted: rgba(42, 32, 37, .66);
  --soft: rgba(255, 139, 171, .12);
  --line: rgba(88, 60, 72, .14);
  --panel: rgba(255, 255, 255, .72);
  --panel-strong: rgba(255, 255, 255, .94);
  --bg: #fff8f2;
  --gold: #ff8bab;
  --rose: #ff8bab;
  --cyan: #75cdbf;
  --violet: #8a7dff;
  --shadow: 0 24px 70px rgba(111, 72, 88, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
html.admin-root, body.admin-body {
  overflow-x: auto;
}
html.admin-root body::before {
  min-width: 1180px;
}
html.admin-root body.admin-body {
  min-width: 1180px;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 139, 171, .28), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(117, 205, 191, .18), transparent 28%),
    linear-gradient(180deg, #fffaf5 0%, #fff3f5 46%, #fff8f2 100%);
  color: var(--ink);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(88, 60, 72, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 60, 72, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 78%);
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled {
  cursor: default;
  opacity: .68;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.site-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}
.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 245, .76);
  backdrop-filter: blur(22px);
  z-index: 5;
}
.brand, .mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-bottom: 28px;
}
.brand-mark {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(37, 99, 235, .18));
  flex: 0 0 auto;
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 4px; color: var(--muted); }
nav { display: grid; gap: 8px; }
.nav-item {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}
.nav-item.active, .nav-item:hover {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
}
.main {
  position: relative;
  padding: 22px clamp(18px, 4vw, 56px) 56px;
  min-width: 0;
}
.topbar {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.mobile-brand {
  display: none;
  margin: 0;
  font-weight: 900;
  color: var(--gold);
}
.mobile-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(37, 99, 235, .18));
}
.admin-brand {
  display: flex;
  margin-bottom: 18px;
  color: var(--ink);
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.eyebrow {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  font-weight: 900;
  margin: 0 0 10px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(42px, 7vw, 92px);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: 22px;
}
h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.06; margin-bottom: 12px; }
p { color: var(--muted); line-height: 1.68; }
.ghost-button, .primary-button, .primary-link, .plain-link {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  border: 1px solid var(--line);
}
.ghost-button, .plain-link { background: rgba(255,255,255,.68); color: var(--ink); }
.primary-button, .primary-link {
  border: 0;
  background: #2a2025;
  color: #fff8f2;
}
.primary-button { width: 100%; }

.auth-panel {
  min-height: calc(100vh - 126px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  gap: 24px;
  align-items: center;
}
.hero-copy {
  position: relative;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 58px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,248,242,.86)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900'%3E%3Crect width='1200' height='900' fill='%23fff8f2'/%3E%3Cpath d='M0 720 C180 610 290 665 438 560 C640 416 800 468 1000 318 C1092 250 1150 172 1200 92 L1200 900 L0 900 Z' fill='%23ffd9e5'/%3E%3Cpath d='M0 150 C192 60 332 176 512 112 C712 40 874 88 1200 20 L1200 380 C890 452 648 402 456 488 C260 576 146 520 0 638 Z' fill='%23fff0f4'/%3E%3Cpath d='M718 650 C808 535 978 548 1064 660 C1136 754 1072 858 932 884 C790 910 634 780 718 650 Z' fill='%2375cdbf' opacity='.22'/%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
}
.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto 26px 26px auto;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(16px);
}
.hero-copy > * { position: relative; z-index: 1; }
.hero-copy h1 { max-width: 900px; }
.hero-lead { max-width: 720px; font-size: 17px; color: rgba(42,32,37,.74); }
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.feature-strip {
  width: min(100%, 640px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
}
.feature-strip div {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(14px);
}
.feature-strip strong, .feature-strip span { display: block; }
.feature-strip strong { font-size: 24px; }
.feature-strip span { margin-top: 4px; color: rgba(42,32,37,.62); font-size: 13px; }

.auth-card, .metric-card, .status-panel, .qr-card, .wallet-card, .table-panel, .invite-panel, .persona-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.auth-card {
  padding: 26px;
  display: grid;
  gap: 16px;
}
.auth-card h2 { margin-bottom: 6px; }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  background: rgba(255, 139, 171, .12);
  border-radius: 999px;
}
.segmented button {
  border: 0;
  min-height: 40px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 10px 26px rgba(111, 72, 88, .12); }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 800; }
input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 15px;
  background: rgba(255,255,255,.7);
  color: var(--ink);
  outline: none;
}
textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  background: rgba(255,255,255,.7);
  color: var(--ink);
  outline: none;
  resize: vertical;
}
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 15px;
  background: rgba(255,255,255,.7);
  color: var(--ink);
  outline: none;
}
select:focus { border-color: rgba(255,139,171,.85); box-shadow: 0 0 0 4px rgba(255,139,171,.15); }
input:focus, textarea:focus { border-color: rgba(255,139,171,.85); box-shadow: 0 0 0 4px rgba(255,139,171,.15); }
.form-tip { margin: 0; font-size: 13px; }

.intro-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 28px 0 10px;
}
.intro-section article {
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.52);
}
.intro-section span {
  display: block;
  color: var(--gold);
  font-weight: 900;
  margin-bottom: 28px;
}

.workspace, .view { min-width: 0; }
.view { display: none; }
.view.active { display: block; }
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 30px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,139,171,.2), rgba(117,205,191,.12)), rgba(255,255,255,.58);
}
.dashboard-hero h1 { font-size: clamp(34px, 5vw, 62px); }
.mini-phone {
  border: 9px solid rgba(42,32,37,.88);
  border-radius: 32px;
  padding: 18px 12px;
  background: #fff3f5;
  display: grid;
  align-content: end;
  gap: 10px;
  min-height: 300px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.metric-card { padding: 22px; }
.metric-card span, .metric-card small { color: var(--muted); display: block; }
.metric-card strong {
  display: block;
  margin: 12px 0 7px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
}
.status-panel, .qr-card, .table-panel, .invite-panel { padding: 24px; }
.panel-title, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head {
  flex-wrap: wrap;
}
.section-head .chips {
  flex: 1 0 100%;
}
.compact-action {
  width: auto;
  min-width: 120px;
}
.badge {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,139,171,.15);
  color: #c74369;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}
.badge.green { background: rgba(117,205,191,.16); color: #2d8c7f; }
.timeline { display: grid; gap: 14px; }
.timeline div { display: flex; gap: 12px; }
.timeline span {
  width: 11px;
  height: 11px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--rose);
  flex: 0 0 auto;
}
.timeline p { margin: 0; }
.chat-row {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 14px;
}
.incoming { background: #fff; color: #2a2025; justify-self: start; box-shadow: 0 8px 18px rgba(111,72,88,.07); }
.outgoing { background: #ffd7e4; color: #2a2025; justify-self: end; border-bottom-right-radius: 6px; }
.incoming:last-child { border-bottom-left-radius: 6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; max-width: 100%; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.64);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 13px;
  white-space: nowrap;
  font-weight: 900;
}
.chip.active { background: #2a2025; color: #fff8f2; border-color: transparent; }
.persona-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.persona-quick-create {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,139,171,.2);
  border-radius: 20px;
  background: rgba(255,255,255,.5);
}
.persona-quick-create h3,
.persona-quick-create p {
  margin: 0;
}
.persona-quick-create p {
  color: var(--muted);
  margin-top: 5px;
}
.persona-quick-create .ghost-button {
  width: auto;
  flex: 0 0 auto;
}
.persona-builder {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42,32,37,.28);
  backdrop-filter: blur(12px);
}
.modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
}
body.modal-open {
  overflow: hidden;
}
.icon-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ai-persona-lab {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(255,139,171,.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,139,171,.14), rgba(117,205,191,.1)), rgba(255,255,255,.52);
}
.ai-persona-lab h3 {
  margin: 0;
  font-size: 20px;
}
.ai-persona-lab .primary-button {
  width: auto;
  min-width: 120px;
}
.persona-form-grid, .admin-persona-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.persona-form-grid .wide, .admin-persona-editor .wide {
  grid-column: 1 / -1;
}
.persona-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.persona-form-actions .primary-button,
.persona-form-actions .ghost-button {
  width: auto;
}
.persona-card {
  padding: 20px;
  min-height: 210px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.persona-card.selected {
  border-color: rgba(255,139,171,.72);
  box-shadow: 0 0 0 4px rgba(255,139,171,.15), var(--shadow);
}
.persona-card h3 { margin: 0; font-size: 20px; }
.persona-card p { margin: 0; }
.persona-card button { width: auto; justify-self: start; padding: 0 18px; min-height: 40px; }
.persona-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bind-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 16px;
}
.web-chat-entry {
  display: grid;
  align-content: start;
  gap: 12px;
}
.web-chat-entry p {
  margin: 0;
  color: var(--muted);
}
.web-chat-entry .primary-button {
  width: auto;
  justify-self: start;
  padding: 0 22px;
}
.chat-modal-panel {
  max-width: 760px;
}
.chat-history {
  height: min(52vh, 480px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.54);
}
.chat-message {
  display: grid;
  gap: 5px;
  max-width: 78%;
}
.chat-message.mine {
  justify-self: end;
}
.chat-message.theirs {
  justify-self: start;
}
.chat-message-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.chat-message.mine .chat-message-meta {
  justify-content: flex-end;
}
.chat-message p {
  margin: 0;
  padding: 11px 13px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.55;
}
.chat-message.mine p {
  background: #2a2025;
  color: #fff8f2;
  border-color: transparent;
  border-bottom-right-radius: 6px;
}
.chat-message.theirs p {
  border-bottom-left-radius: 6px;
}
.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
  align-items: end;
}
.chat-composer textarea {
  min-height: 50px;
  resize: vertical;
}
.chat-composer .primary-button {
  width: auto;
  min-width: 96px;
}
.qr-box {
  aspect-ratio: 1;
  border: 1px dashed rgba(255,139,171,.46);
  border-radius: 24px;
  display: grid;
  place-items: center;
  margin: 18px 0;
  color: var(--muted);
  text-align: center;
  padding: 18px;
  background: rgba(255,255,255,.52);
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; border-radius: 18px; }
.clean-list { margin: 0; padding-left: 18px; color: var(--muted); line-height: 2.1; }
.wallet-card {
  padding: 28px;
  display: grid;
  gap: 18px;
  background: linear-gradient(135deg, rgba(255,139,171,.18), rgba(117,205,191,.12)), var(--panel);
}
.wallet-actions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.plan-summary, .purchase-status, .user-plan-card, .admin-detail-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.plan-summary, .purchase-status, .user-plan-card { padding: 22px; }
.plan-summary dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.plan-summary dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.plan-summary dt, .plan-summary dd { margin: 0; }
.plan-summary dt { color: var(--muted); font-weight: 800; }
.plan-summary dd { font-weight: 950; text-align: right; }
.order-box {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.64);
  border: 1px solid var(--line);
  color: var(--muted);
}
.order-box strong { color: var(--ink); }
.redeem-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}
.redeem-form .primary-button {
  width: auto;
  white-space: nowrap;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.user-plan-card {
  min-height: 260px;
  display: grid;
  gap: 16px;
  align-content: space-between;
}
.user-plan-card.current {
  border-color: rgba(117,205,191,.5);
}
.user-plan-card h3 { margin: 0 0 8px; font-size: 22px; }
.user-plan-card p { margin: 0; }
.plan-price strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}
.plan-price span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}
.wallet-card h2 { font-size: clamp(36px, 5vw, 64px); margin-bottom: 4px; }
.progress { height: 12px; background: rgba(42,32,37,.08); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rose), var(--cyan)); }
.table-panel { margin-top: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 13px; }
.invite-panel { max-width: 820px; }
.invite-link {
  word-break: break-all;
  padding: 16px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-weight: 900;
  margin: 12px 0;
}
.invite-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}
.invite-actions .primary-button,
.invite-actions .ghost-button {
  width: auto;
}
.invite-panel #inviteCodeText {
  margin-top: 0;
  color: var(--muted);
}
.invite-records {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.invite-record-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.invite-record-head h3 {
  margin: 0;
  font-size: 22px;
}
.invite-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.invite-summary span {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,139,171,.13);
  color: #c74369;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}
.invite-record-list {
  display: grid;
  gap: 9px;
}
.invite-record-item,
.empty-record {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.54);
  padding: 13px;
}
.invite-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.invite-record-item strong {
  display: block;
  font-size: 15px;
}
.invite-record-item span,
.empty-record {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.invite-record-item > div:last-child {
  text-align: right;
  flex: 0 0 auto;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  z-index: 20;
  background: #2a2025;
  color: #fff8f2;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  max-width: calc(100vw - 32px);
  font-weight: 900;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.admin-desktop-page {
  min-height: 100vh;
  padding: 0;
  background: #f7f3f1;
  min-width: 1180px;
}
.admin-login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: center;
  padding: 48px;
}
.admin-login-copy {
  max-width: 760px;
  padding: 44px;
}
.admin-login-copy h1 {
  font-size: clamp(54px, 7vw, 92px);
  line-height: .95;
}
.admin-login-card {
  background: rgba(255,255,255,.88);
}
.admin-desktop {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-width: 1180px;
}
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-logo-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 950;
  color: var(--ink);
}
.admin-logo-line img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.admin-side-label {
  margin: 26px 10px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.admin-side-link {
  flex: 0 0 auto;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #2a2025;
  color: #fff8f2;
  font-weight: 900;
  margin-top: 12px;
}
.admin-main {
  min-width: 0;
  padding: 24px 28px 40px;
}
.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
}
.admin-topbar h1 {
  font-size: 34px;
  line-height: 1.05;
  margin: 0;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.admin-stat {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.admin-stat span { color: var(--muted); display: block; }
.admin-stat strong { display: block; margin-top: 12px; font-size: 28px; }
.admin-tabs {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  min-height: 0;
  flex: 1 1 auto;
  padding-right: 4px;
}
.admin-tabs button {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
  font-weight: 900;
  text-align: left;
}
.admin-tabs button.active {
  background: #f7dfe7;
  color: #2a2025;
}
.admin-view { display: none; }
.admin-view.active { display: block; }
.admin-tools, .settings-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  align-items: end;
}
.admin-persona-editor {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  background: #fbf7f5;
  border: 1px solid var(--line);
}
.admin-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.admin-subtabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 900;
  color: var(--muted);
}
.admin-subtabs button.active {
  background: #2a2025;
  color: #fff8f2;
  border-color: transparent;
}
.redeem-tools {
  grid-template-columns: 1.4fr 1fr 1.25fr .8fr .8fr 1.3fr auto;
}
.generated-codes {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fbf7f5;
  border: 1px solid var(--line);
}
.generated-codes span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.generated-codes strong {
  color: var(--ink);
  word-break: break-all;
}
.settings-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.settings-grid .settings-wide {
  grid-column: 1 / -1;
}
.settings-grid textarea {
  min-height: 118px;
  resize: vertical;
}
.key-pool-list {
  display: grid;
  gap: 8px;
}
.key-pool-item {
  display: grid;
  grid-template-columns: 1.4fr .55fr .5fr .6fr 1.5fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.66);
  color: var(--muted);
  font-size: 13px;
}
.key-pool-item span:first-child {
  color: var(--ink);
  font-weight: 800;
}
.muted-line {
  color: var(--muted);
  font-size: 13px;
}
.admin-tools .primary-button, .admin-tools .ghost-button, .admin-save {
  min-height: 50px;
  width: auto;
}
.admin-save { margin-top: 14px; }
.action-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-cell button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: var(--ink);
  min-height: 34px;
  padding: 0 11px;
  font-weight: 800;
  white-space: nowrap;
}
.action-cell .danger-action {
  border-color: rgba(210, 78, 102, .26);
  background: rgba(255, 231, 235, .82);
  color: #b42348;
}
.admin-main .table-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 46px rgba(111, 72, 88, .08);
}
.admin-main table {
  min-width: 760px;
}
.admin-main th {
  background: #fbf7f5;
  color: rgba(42,32,37,.58);
}
.admin-main td, .admin-main th {
  padding: 12px 11px;
}
.admin-detail-panel {
  padding: 18px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: 0 16px 46px rgba(111, 72, 88, .08);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbf7f5;
}
.detail-grid span, .compact-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.detail-grid strong {
  display: block;
  margin-top: 6px;
}
.detail-columns, .log-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.log-columns { grid-template-columns: 1fr 1fr; }
.detail-columns h3, .log-columns h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.compact-list {
  display: grid;
  gap: 8px;
}
.compact-list div {
  padding: 11px;
  border-radius: 12px;
  background: #fbf7f5;
  border: 1px solid var(--line);
}
.compact-list strong {
  display: block;
  margin-bottom: 5px;
}

@media (max-width: 1080px) {
  .site-shell { grid-template-columns: 1fr; }
  .side-nav {
    height: auto;
    position: fixed;
    inset: auto 10px 10px;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 7px;
  }
  .brand { display: none; }
  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }
  .nav-item {
    min-height: 48px;
    padding: 0 2px;
    text-align: center;
    font-size: 12px;
    border-radius: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .main { padding: 14px 14px 88px; }
  .mobile-brand { display: flex; }
  .auth-panel, .dashboard-hero, .bind-layout { grid-template-columns: 1fr; }
  .auth-panel { min-height: auto; }
  .hero-copy { min-height: 560px; border-radius: 24px; }
  .hero-copy::after { display: none; }
  .intro-section, .stats-grid, .wallet-actions-grid, .plan-grid, .persona-form-grid, .ai-persona-lab { grid-template-columns: 1fr; }
  .persona-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .section-head { display: grid; }
  .compact-action { width: 100%; }
  .admin-tools, .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 34px;
    line-height: 1.08;
    margin-bottom: 18px;
  }
  .topbar-actions .ghost-button:first-child { display: none; }
  .hero-copy {
    min-height: 500px;
    padding: 24px;
    justify-content: center;
  }
  .hero-copy h1 {
    max-width: 100%;
    padding-right: 0;
  }
  .hero-lead { font-size: 15px; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature-strip div { padding: 13px 14px; }
  .auth-card, .metric-card, .status-panel, .qr-card, .wallet-card, .table-panel, .invite-panel, .persona-card, .plan-summary, .purchase-status, .user-plan-card { border-radius: 20px; }
  .dashboard-hero { padding: 22px; border-radius: 22px; }
  .persona-grid {
    gap: 9px;
  }
  .persona-card {
    min-height: 0;
    padding: 13px;
    gap: 7px;
    border-radius: 18px;
  }
  .persona-card .eyebrow {
    font-size: 11px;
  }
  .persona-card h3 {
    font-size: 16px;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .persona-card p {
    font-size: 12px;
    line-height: 1.45;
  }
  .persona-card p:nth-of-type(2) {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .persona-card p:nth-of-type(3) {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .persona-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 2px;
  }
  .persona-card button {
    width: 100%;
    min-height: 34px;
    padding: 0 8px;
    justify-self: stretch;
    font-size: 12px;
    border-radius: 999px;
  }
  .persona-quick-create {
    display: grid;
    padding: 15px;
  }
  .persona-quick-create .ghost-button {
    width: 100%;
  }
  .invite-record-head {
    display: grid;
  }
  .invite-summary {
    justify-content: flex-start;
  }
  .invite-record-item {
    align-items: flex-start;
  }
  .web-chat-entry .primary-button {
    width: 100%;
  }
  .chat-history {
    height: 48vh;
    padding: 12px;
  }
  .chat-message {
    max-width: 90%;
  }
  .chat-composer {
    grid-template-columns: 1fr;
  }
  .chat-composer .primary-button {
    width: 100%;
  }
  .modal {
    align-items: end;
    padding: 10px;
  }
  .modal-panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 24px 24px 18px 18px;
    padding: 18px;
  }
  .persona-builder .panel-title {
    align-items: center;
  }
  .persona-builder .panel-title h2 {
    font-size: 24px;
    line-height: 1.15;
  }
  .ai-persona-lab {
    padding: 14px;
  }
  .ai-persona-lab h3 {
    font-size: 18px;
  }
  .mini-phone { min-height: 220px; }
  .chat-row {
    font-size: 13px;
    padding: 9px 11px;
  }
}

html.admin-root .admin-page,
html.admin-root .admin-desktop-page,
html.admin-root .admin-desktop {
  min-width: 1180px;
}

html.admin-root .admin-tabs {
  display: grid;
}

html.admin-root .admin-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

html.admin-root .admin-tools {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

html.admin-root .redeem-tools {
  grid-template-columns: 1.4fr 1fr 1.25fr .8fr .8fr 1.3fr auto;
}

html.admin-root .settings-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

html.admin-root .topbar-actions .ghost-button:first-child {
  display: inline-grid;
}

@media (max-width: 390px) {
  h1 { font-size: 31px; }
  .hero-copy h1 {
    max-width: 100%;
    padding-right: 0;
    margin-top: 18px;
  }
  .redeem-form { grid-template-columns: 1fr; }
  .redeem-form .primary-button { width: 100%; }
}
