:root {
  color-scheme: dark;
  --bg: #080a0a;
  --panel: #0d1010;
  --panel-2: #101414;
  --line: #202626;
  --line-strong: #303939;
  --text: #f1f5f4;
  --muted: #8a9694;
  --accent: #ccff00;
  --accent-ink: #111500;
  --danger: #ff6b78;
  --ok: #79e2af;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.public-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 35%, #111716 0, var(--bg) 42%); }
.redeem-shell { width: min(100%, 520px); }
.redeem-card { display: flex; gap: 8px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(15,19,19,.88); box-shadow: 0 24px 90px rgba(0,0,0,.48); }
.redeem-card input { flex: 1; min-width: 0; border: 0; padding: 15px 17px; color: var(--text); background: transparent; font-size: 16px; letter-spacing: .025em; }
.redeem-card input::placeholder { color: #7f8a88; }
.redeem-card button, .primary { border: 0; border-radius: 8px; padding: 0 20px; color: var(--accent-ink); background: var(--accent); font-weight: 750; }
.redeem-card button:hover, .primary:hover { background: #dcff45; }
.redeem-card button:disabled { opacity: .55; cursor: progress; }
.redeem-result { margin-top: 12px; padding: 20px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--panel); text-align: center; }
.redeem-result.error { border-color: rgba(255,107,120,.55); color: #ffbdc5; }
.redeem-product { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.otp-code { display: block; color: var(--accent); font-size: clamp(30px, 7vw, 44px); font-weight: 800; letter-spacing: .13em; overflow-wrap: anywhere; }

.panel-page { background: #090b0b; }
.app-shell { display: grid; grid-template-columns: 238px minmax(0,1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; border-right: 1px solid var(--line); background: #0a0d0d; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 23px; height: 15px; border-radius: 10px 2px 10px 2px; background: var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 5px 4px; border-radius: 100%; background: #0a0d0d; }
.nav { display: grid; gap: 3px; }
.nav button { display: flex; align-items: center; width: 100%; padding: 10px 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; text-align: left; }
.nav button:hover { color: var(--text); background: #151a19; }
.nav button.active { color: var(--accent); background: #1a2209; }
.account { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line); }
.account strong, .account span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account span { margin-top: 3px; color: var(--muted); font-size: 13px; }
.logout { margin-top: 10px; padding: 0; color: var(--muted); border: 0; background: transparent; font-size: 13px; }
.logout:hover { color: var(--text); }
.workspace { min-width: 0; padding: 44px clamp(24px, 4vw, 56px); }
.page-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
h1 { margin: 0; font-size: clamp(24px, 3vw, 33px); letter-spacing: -.05em; }
.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(120px,1fr)); gap: 12px; margin-bottom: 22px; }
.stat, .card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.stat { padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 7px; font-size: 28px; letter-spacing: -.05em; }
.card { padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 15px; font-size: 16px; letter-spacing: -.02em; }
.card p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, .9fr); gap: 16px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: #cbd3d1; font-size: 13px; }
input, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; padding: 10px 11px; color: var(--text); background: #0a0d0d; }
select { appearance: auto; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.primary { min-height: 39px; padding: 0 14px; }
.secondary, .danger { min-height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; color: #dfe7e5; background: transparent; font-size: 13px; }
.secondary:hover { border-color: #5a6764; background: #141a19; }
.danger { color: #ffabb4; border-color: #5a2d34; }
.danger:hover { background: #2a1418; }
.notice { padding: 12px; border: 1px solid #45510f; border-radius: 7px; color: #dfffa0; background: #161e08; font-size: 13px; }
.notice code { color: var(--accent); word-break: break-all; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }
.list-item:first-child { padding-top: 0; border-top: 0; }
.list-main { min-width: 0; }
.list-main strong, .list-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.list-side { display: flex; align-items: center; justify-content: end; gap: 8px; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; color: #b9c4c1; background: #171d1c; font-size: 11px; }
.badge.ok { color: #9ef0c3; background: #10281e; }
.badge.off { color: #f0aab1; background: #2a1519; }
.empty { color: var(--muted); padding: 12px 0; font-size: 14px; }
.code-once { margin-top: 12px; padding: 13px; border: 1px dashed #668000; border-radius: 8px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; word-break: break-all; }
.login-wrap { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(100%, 390px); padding: 28px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); }
.login-card .brand { padding: 0 0 28px; }
.login-card .login-field { gap: 9px; line-height: 1.35; }
.login-card .login-field + .login-field { margin-top: 22px; }
.login-card .login-field > span { display: block; }
.login-card .login-field > input { min-height: 42px; }
.login-card .primary { width: 100%; margin-top: 17px; }
.form-error { min-height: 20px; margin: 10px 0 0; color: #ff9ca8; font-size: 13px; }
.api-docs { margin: 0; padding: 13px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; color: #c9d5d1; background: #070909; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.toast-region { position: fixed; z-index: 10; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border: 1px solid #3d4946; border-radius: 8px; color: #e6efec; background: #151b1a; box-shadow: 0 8px 30px rgba(0,0,0,.35); font-size: 13px; }
.toast.error { border-color: #74313c; color: #ffc1c8; }
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 2; top: 0; flex-direction: row; align-items: center; gap: 10px; padding: 10px 15px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand { padding: 4px 3px; flex-shrink: 0; }
  .nav { display: flex; gap: 3px; }
  .nav button { width: auto; white-space: nowrap; }
  .account { display: none; }
  .workspace { padding: 28px 18px; }
  .grid-stats, .split, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .page-head { flex-direction: column; }
  .list-item { align-items: start; flex-direction: column; }
  .list-side { justify-content: start; }
}
