:root {
  color-scheme: light;
  --ink: #17202b;
  --muted: #667085;
  --line: #e5e9ef;
  --surface: #ffffff;
  --wash: #f4f6f8;
  --navy: #14243a;
  --green: #147d64;
  --green-dark: #0e6250;
  --amber: #c17814;
  --red: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--wash); color: var(--ink); }
button, input { font: inherit; }
select { width: 100%; border: 1px solid #cbd2da; border-radius: 9px; padding: 11px 12px; background: white; color: var(--ink); font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: var(--navy); color: white; padding: 18px 0; }
.topbar .shell { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 750; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(20, 36, 58, .05); }
.iframe-wrap { width: min(620px, calc(100% - 28px)); margin: 28px auto; }
.iframe-wrap .card { padding: 26px; }
.identity { display: flex; gap: 14px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 24px; margin-bottom: 6px; }
h2 { font-size: 19px; }
.form-section { padding-top: 22px; }
label { display: block; font-weight: 650; font-size: 14px; margin-bottom: 7px; }
input { width: 100%; border: 1px solid #cbd2da; border-radius: 9px; padding: 11px 12px; background: white; color: var(--ink); }
input:focus { outline: 3px solid rgba(20,125,100,.14); border-color: var(--green); }
.input-money { position: relative; }
.input-money span { position: absolute; right: 12px; top: 11px; color: var(--muted); font-weight: 650; }
.input-money input { padding-right: 48px; }
.btn { border: 0; border-radius: 9px; padding: 11px 16px; font-weight: 700; background: var(--green); color: white; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.secondary { background: #e9edf2; color: var(--ink); }
.btn.danger { background: var(--red); }
.full { width: 100%; }
.account-box { border: 1px solid #cde6df; background: #f2fbf8; border-radius: 12px; padding: 18px; margin: 20px 0; }
.account-row { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; border-bottom: 1px solid #d9ece7; }
.account-row:last-child { border: 0; }
.account-row span:first-child { color: var(--muted); }
.account-row strong { text-align: right; word-break: break-word; }
.notice { padding: 12px 14px; border-radius: 9px; margin: 14px 0; background: #fff8e8; color: #7a4c05; }
.notice.error { background: #fff0ee; color: var(--red); }
.notice.success { background: #ecfdf5; color: #087455; }
.hidden { display: none !important; }
.admin-main { padding: 28px 0 60px; }
.toolbar { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs { flex-wrap: wrap; }
.menu-toggle { border: 0; background: transparent; color: white; font-size: 25px; line-height: 1; padding: 4px 8px; }
.live-status { color: #86efac; font-size: 13px; font-weight: 700; white-space: nowrap; }
.live-status.syncing { color: #fde68a; }
.live-status.error { color: #fca5a5; }
.side-menu { position: fixed; z-index: 20; top: 68px; left: 0; width: 260px; max-height: calc(100vh - 68px); overflow-y: auto; padding: 16px; background: var(--navy); box-shadow: 8px 14px 30px rgba(0,0,0,.2); display: flex; flex-direction: column; align-items: stretch; transform: translateX(-105%); transition: transform .2s ease; }
.side-menu.open { transform: translateX(0); }
.side-menu .tab { text-align: left; border-color: rgba(255,255,255,.13); background: rgba(255,255,255,.08); color: white; border-radius: 8px; }
.side-menu .tab.active { background: var(--green); }
.tab { border: 1px solid var(--line); border-radius: 99px; background: white; padding: 8px 14px; }
.tab.active { color: white; background: var(--navy); border-color: var(--navy); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { padding: 18px; }
.stat strong { display: block; font-size: 26px; margin-top: 5px; }
.panel { padding: 20px; margin-top: 16px; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-block; border-radius: 99px; padding: 4px 8px; font-size: 12px; font-weight: 700; background: #eef1f5; }
.badge.PAYMENT_REPORTED { background: #fff1ce; color: #855300; }
.badge.COMPLETED { background: #dcfce7; color: #166534; }
.badge.API_ERROR, .badge.REJECTED { background: #fee2e2; color: #991b1b; }
.actions { display: flex; gap: 6px; }
.actions .btn { padding: 7px 10px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.form-grid .wide { grid-column: span 2; }
.login { width: min(400px, calc(100% - 28px)); margin: 10vh auto; padding: 26px; }
.login input { margin-bottom: 14px; }
dialog { width: min(820px, calc(100% - 28px)); border: 0; border-radius: 14px; padding: 24px; box-shadow: 0 18px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,36,58,.5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.permission-grid label { padding: 9px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }
.permission-grid input { width: auto; margin-right: 6px; }
.secret-box { padding: 12px; border-radius: 8px; background: #eef1f5; word-break: break-all; font-family: ui-monospace, monospace; }
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .iframe-wrap .card { padding: 20px; }
}
