:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --success: #059669;
  --warning: #b45309;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { background: var(--bg) !important; color: var(--text) !important; }
body { font-size: 14px; letter-spacing: -.01em; }
a { color: var(--primary) !important; text-decoration: none !important; }
.topbar {
  height: 68px !important;
  padding: 0 28px !important;
  background: rgba(255, 255, 255, .94) !important;
  border-bottom: 1px solid var(--line) !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px);
}
.brand { gap: 12px !important; }
.brand-mark {
  width: 36px !important;
  height: 36px !important;
  border-radius: 12px !important;
  background: var(--text) !important;
  font-size: 12px !important;
  letter-spacing: .04em;
}
.brand-title { font-size: 17px !important; font-weight: 760 !important; }
.brand-subtitle { color: var(--muted) !important; font-size: 12px !important; }
.top-menu { gap: 6px !important; }
.top-menu a {
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
  color: #374151 !important;
  font-weight: 650 !important;
}
.top-menu a:hover,
.top-menu a.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}
.userbar, #auth { position: relative; display: flex; justify-content: flex-end; }
.login-button,
.user-menu-trigger,
button,
a.button {
  min-height: 38px !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: var(--panel) !important;
  color: #374151 !important;
  box-shadow: none !important;
  font-weight: 700 !important;
}
button.primary,
.button:not(.secondary) {
  border-color: var(--primary) !important;
  background: var(--primary) !important;
  color: #fff !important;
}
.button.secondary {
  border-color: #bfdbfe !important;
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}
.user-avatar { background: var(--text) !important; }
.user-menu {
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
}
.shell { height: calc(100vh - 68px) !important; background: var(--bg) !important; }
.side-menu {
  width: 236px !important;
  flex-basis: 236px !important;
  padding: 22px 16px !important;
  border-right: 1px solid var(--line) !important;
  background: var(--panel) !important;
  gap: 8px !important;
}
.side-menu-title {
  padding: 0 12px 10px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.side-menu a {
  min-height: 40px !important;
  border-radius: 10px !important;
  color: #4b5563 !important;
  font-weight: 680 !important;
}
.side-menu a:hover,
.side-menu a.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}
main {
  padding: 28px !important;
  background: var(--bg) !important;
}
body > .shell > main:only-child,
.shell > main:first-child:last-child {
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
  padding-top: 44px !important;
}
h1 {
  color: var(--text) !important;
  font-size: clamp(28px, 4vw, 46px) !important;
  font-weight: 780 !important;
  letter-spacing: -.04em !important;
}
h2 {
  color: var(--text) !important;
  font-weight: 760 !important;
}
p, li, .muted, .empty { color: var(--muted) !important; }
.lead { color: #4b5563 !important; font-size: 18px !important; }
.hero-panel {
  padding: 28px !important;
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #fff 0%, #f8fbff 100%) !important;
  box-shadow: var(--shadow) !important;
}
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.change-list { display: grid; gap: 0; }
.change-item { display: grid; grid-template-columns: 116px 1fr; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line); }
.change-item:last-child { border-bottom: 0; }
.change-date { color: var(--muted); font-size: 12px; font-weight: 760; }
.change-title { margin: 0 0 6px; color: var(--text); font-weight: 780; }
.change-item ul { margin: 8px 0 0; padding-left: 18px; }
.recharge-panel { padding: 18px; }
.recharge-form {
  display: grid !important;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, .8fr) minmax(180px, .8fr) auto !important;
  gap: 14px !important;
  align-items: end !important;
  padding: 0 !important;
}
.amount-field {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.amount-field input {
  min-height: 44px !important;
  border: 0 !important;
  padding: 0 !important;
  font-size: 28px !important;
  font-weight: 780 !important;
  box-shadow: none !important;
}
.amount-field input:focus { box-shadow: none !important; }
.quick-amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick-amounts button {
  min-height: 30px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
  border-color: #bfdbfe !important;
}
.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}
.payment-modal[hidden] { display: none; }
.payment-dialog {
  width: min(560px, 100%);
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}
.payment-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.payment-dialog-title { font-weight: 780; }
.payment-dialog iframe {
  width: 100%;
  height: 560px;
  border: 0;
  display: block;
  background: #f8fafc;
}
.product-card-selected {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1) !important;
}
.entitlement-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}
.entitlement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}
.entitlement-row span { color: var(--muted); font-size: 13px; }
.embedded-purchase .topbar,
.embedded-purchase .side-menu { display: none !important; }
.embedded-purchase .shell {
  display: block !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.embedded-purchase main {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 12px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.embedded-purchase main > .toolbar { display: none !important; }
.embedded-purchase #product-payment { margin: 0 !important; box-shadow: none !important; }
.embedded-purchase .product-list { grid-template-columns: 1fr !important; }
.embedded-purchase .product-card { background: #fff !important; }
.toolbar {
  align-items: flex-start !important;
  margin-bottom: 20px !important;
}
.toolbar h1 { font-size: 26px !important; letter-spacing: -.03em !important; }
.grid { gap: 16px !important; }
.card,
section,
.product-card {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow) !important;
}
.card { padding: 20px !important; }
.card span,
th,
label {
  color: var(--muted) !important;
  font-size: 12px !important;
  letter-spacing: .02em;
}
.card strong { color: var(--text) !important; font-weight: 780 !important; }
section { margin-bottom: 18px !important; overflow: hidden !important; }
section h2 {
  padding: 16px 18px !important;
  border-bottom: 1px solid var(--line) !important;
  background: var(--panel-soft);
  font-size: 16px !important;
}
input,
select,
textarea {
  min-height: 40px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--text) !important;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
table { background: var(--panel) !important; }
th, td { padding: 13px 14px !important; border-bottom: 1px solid #eef2f7 !important; }
td span { color: var(--muted) !important; }
.badge {
  min-height: 24px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 760 !important;
}
.badge.active,
.badge.credited,
.badge.processed,
.badge.recharge { background: #ecfdf5 !important; color: var(--success) !important; }
.badge.pending,
.badge.refunding,
.badge.replay_requested { background: #fffbeb !important; color: var(--warning) !important; }
.badge.disabled,
.badge.failed,
.badge.debit,
.badge.refund { background: #fef2f2 !important; color: var(--danger) !important; }
footer { display: none !important; }
@media (max-width: 760px) {
  html { min-height: 100%; overflow-x: hidden !important; overflow-y: auto !important; }
  body { min-height: 100dvh; overflow-x: hidden !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
  .topbar { height: auto !important; padding: 12px !important; }
  .shell { height: auto !important; min-height: calc(100vh - 64px); display: block !important; overflow: visible !important; }
  .side-menu { width: auto !important; height: auto !important; display: flex !important; overflow-x: auto !important; overflow-y: hidden !important; -webkit-overflow-scrolling: touch; }
  .top-menu, section { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  main { height: auto !important; min-height: 0 !important; padding: 16px !important; overflow: visible !important; overscroll-behavior: auto !important; }
  .about-grid { grid-template-columns: 1fr; }
  .change-item { grid-template-columns: 1fr; gap: 8px; }
  .recharge-form { grid-template-columns: 1fr !important; }
  .payment-modal { align-items: start; overflow-x: hidden; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
  .payment-dialog { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .payment-dialog iframe { height: min(520px, calc(100dvh - 82px)); min-height: 420px; }
}