:root {
  --ink: #122033;
  --muted: #657184;
  --line: #dfe5ec;
  --soft: #f2f5f9;
  --paper: #fbfcfe;
  --navy: #101b2f;
  --navy-2: #172744;
  --blue: #2563eb;
  --blue-2: #60a5fa;
  --cyan: #22d3ee;
  --coral: #ff7a59;
  --green: #0d9f6e;
  --red: #d94747;
  --shadow: 0 22px 60px rgba(20, 39, 72, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { display: block; color: var(--blue); font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .16em; text-transform: uppercase; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.05fr) minmax(520px, .95fr); background: #fff; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 52px 7vw; color: white; background: linear-gradient(150deg, #0c172a 0%, #15284a 52%, #1e3a8a 100%); }
.auth-brand::before { content: ""; position: absolute; inset: auto -10% -32% 16%; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 90px rgba(37,99,235,.12), 0 0 0 180px rgba(34,211,238,.06); }
.auth-brand::after { content: ""; position: absolute; width: 420px; height: 420px; top: -210px; right: -140px; background: radial-gradient(circle, rgba(34,211,238,.45), transparent 67%); }
.brand-lockup { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand-lockup .brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.28); border-radius: 14px 4px 14px 4px; color: #0d1a2c; background: linear-gradient(135deg, var(--cyan), #fff); font-weight: 800; letter-spacing: -.06em; }
.brand-lockup b, .brand-lockup small { display: block; }
.brand-lockup b { font-size: 17px; letter-spacing: -.02em; }
.brand-lockup small { opacity: .66; font: 500 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .16em; }
.auth-promise { position: relative; z-index: 1; max-width: 680px; }
.auth-promise .eyebrow { color: var(--cyan); }
.auth-promise h1 { margin: 22px 0; font-size: clamp(42px, 4.8vw, 74px); line-height: 1.13; letter-spacing: -.055em; }
.auth-promise > p { max-width: 610px; color: rgba(255,255,255,.72); font-size: 17px; }
.promise-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 36px; }
.promise-grid article { padding: 18px 20px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.055); backdrop-filter: blur(12px); }
.promise-grid b, .promise-grid span { display: block; }
.promise-grid span { margin-top: 3px; color: rgba(255,255,255,.58); font-size: 12px; }
.auth-footnote { position: relative; z-index: 1; color: rgba(255,255,255,.48); font-size: 12px; }
.auth-panel { display: grid; place-items: center; padding: 50px 7vw; background: radial-gradient(circle at 100% 0%, #eef5ff, transparent 40%), #fff; }
.auth-card { width: min(580px, 100%); }
.auth-tabs { display: inline-flex; gap: 5px; margin-bottom: 38px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.auth-tabs button { padding: 9px 24px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-weight: 700; }
.auth-tabs button.active { color: white; background: var(--navy); box-shadow: 0 5px 16px rgba(16,27,47,.18); }
.auth-form { display: none; }
.auth-form.active { display: block; animation: enter .35s ease; }
.auth-form h2 { margin: 8px 0 2px; font-size: 34px; letter-spacing: -.04em; }
.auth-form > p { margin: 0 0 28px; color: var(--muted); }
label { display: grid; gap: 7px; margin-bottom: 16px; color: #3b4657; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #d5dce6; border-radius: 10px; outline: none; color: var(--ink); background: #fff; transition: .2s; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.09); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.consent { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-weight: 500; }
.consent input { flex: 0 0 auto; width: 17px; min-height: auto; height: 17px; margin-top: 4px; }
.primary-button, .secondary-button { min-height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent; font-weight: 750; }
.primary-button { color: white; background: linear-gradient(135deg, var(--blue), #1d4ed8); box-shadow: 0 10px 28px rgba(37,99,235,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(37,99,235,.3); }
.primary-button:disabled { opacity: .5; transform: none; cursor: not-allowed; box-shadow: none; }
.primary-button.compact { min-height: 40px; }
.auth-form > .primary-button { width: 100%; margin-top: 5px; }
.auth-form > small { display: block; margin-top: 15px; color: #8b95a5; text-align: center; }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line); }
.form-feedback { min-height: 22px; margin: -4px 0 8px; color: var(--red); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); background: #f5f7fa; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px; color: #d9e2f2; background: var(--navy); }
.brand-lockup.compact { margin: 0 10px 40px; }
.brand-lockup.compact .brand-mark { width: 42px; height: 42px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 9px; color: #94a4bd; background: transparent; text-align: left; }
.sidebar nav button i { width: 25px; color: #6f86a8; font-style: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; }
.sidebar nav button:hover { color: white; background: rgba(255,255,255,.05); }
.sidebar nav button.active { color: white; background: linear-gradient(90deg, rgba(37,99,235,.34), rgba(37,99,235,.11)); box-shadow: inset 3px 0 var(--cyan); }
.sidebar nav button.active i { color: var(--cyan); }
.sidebar-card { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04); }
.sidebar-card span, .sidebar-card b, .sidebar-card small { display: block; }
.sidebar-card span { color: #7f91ab; font-size: 11px; }
.sidebar-card b { margin: 3px 0; color: white; }
.sidebar-card small { color: #71829b; font-size: 10px; }
.logout-button { margin-top: 12px; padding: 10px; border: 0; color: #8394ad; background: transparent; }
.workspace { min-width: 0; padding: 0 36px 55px; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 100px; border-bottom: 1px solid var(--line); background: rgba(245,247,250,.9); backdrop-filter: blur(18px); }
.topbar h1 { margin: 3px 0 0; font-size: 27px; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.service-status, .customer-chip, .currency-badge, .version-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 12px; }
.service-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(13,159,110,.1); }
.customer-chip { color: var(--ink); font-weight: 650; }
.page { display: none; padding-top: 32px; animation: enter .3s ease; }
.page.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-strip { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 34px 38px; border-radius: 18px; color: white; background: linear-gradient(120deg, var(--navy), #17386c); box-shadow: var(--shadow); }
.hero-strip::after { content: ""; position: absolute; width: 380px; height: 380px; right: -110px; top: -170px; border: 1px solid rgba(34,211,238,.25); border-radius: 50%; box-shadow: 0 0 0 55px rgba(34,211,238,.05), 0 0 0 110px rgba(37,99,235,.06); }
.hero-strip > * { position: relative; z-index: 1; }
.hero-strip .eyebrow { color: var(--cyan); }
.hero-strip h2 { margin: 7px 0 3px; font-size: 29px; letter-spacing: -.035em; }
.hero-strip p { margin: 0; color: rgba(255,255,255,.63); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.stat-grid article, .wallet-grid article { min-height: 126px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.stat-grid span, .stat-grid b, .stat-grid small, .wallet-grid span, .wallet-grid b, .wallet-grid small { display: block; }
.stat-grid span, .wallet-grid span { color: var(--muted); font-size: 12px; }
.stat-grid b, .wallet-grid b { margin: 7px 0; font-size: 28px; letter-spacing: -.04em; }
.stat-grid small, .wallet-grid small { color: #8c96a5; }
.loading-grid article { background: linear-gradient(100deg, #fff, #f0f3f7, #fff); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.dashboard-grid { display: grid; grid-template-columns: 1.55fr .75fr; gap: 16px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel h3 { margin: 5px 0 0; font-size: 19px; }
.text-button { padding: 4px; border: 0; color: var(--blue); background: transparent; font-weight: 650; }
.quick-steps { display: grid; gap: 15px; margin: 22px 0 0; padding: 0; list-style: none; }
.quick-steps li { display: flex; gap: 13px; align-items: center; }
.quick-steps li > b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--blue); background: #eef4ff; font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.quick-steps span, .quick-steps small { display: block; }
.quick-steps small { color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { margin: 5px 0 1px; font-size: 32px; letter-spacing: -.04em; }
.section-heading p { margin: 0; color: var(--muted); }
.currency-badge { color: var(--blue); border-color: #cbdafa; font-weight: 800; }
.version-badge { color: white; border: 0; background: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.filters { display: grid; grid-template-columns: minmax(260px, 1fr) 180px 160px; gap: 10px; margin-bottom: 15px; }
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.model-card { display: flex; flex-direction: column; min-height: 190px; padding: 21px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: .2s; }
.model-card:hover { transform: translateY(-2px); border-color: #b9cae7; box-shadow: 0 14px 36px rgba(26,48,85,.09); }
.model-card header { display: flex; justify-content: space-between; gap: 12px; }
.model-card h3 { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.model-card code { display: block; margin: 7px 0 16px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.capability-tag, .status-tag { display: inline-flex; width: fit-content; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.capability-tag { color: #1d4ed8; background: #eaf1ff; }
.status-tag.ready { color: #067451; background: #e5f7ef; }
.status-tag.offline { color: #9c5c10; background: #fff2dc; }
.model-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; color: var(--muted); font-size: 11px; }
.model-meta span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; }
.loading-state, .empty-state { grid-column: 1/-1; min-height: 160px; display: grid; place-items: center; color: #8994a4; border: 1px dashed #d4dbe5; border-radius: 13px; background: rgba(255,255,255,.5); }
.security-note { display: flex; gap: 15px; margin-bottom: 16px; padding: 15px 18px; border-left: 3px solid var(--coral); border-radius: 5px 11px 11px 5px; color: #6c594d; background: #fff7f3; }
.key-list, .invoice-list { display: grid; gap: 10px; }
.key-row, .invoice-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) 1fr 1fr auto; align-items: center; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.key-row b, .key-row span, .key-row small, .invoice-row b, .invoice-row span, .invoice-row small { display: block; }
.key-row code { color: var(--blue); font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.key-row small, .invoice-row small { color: var(--muted); }
.danger-button { min-height: 36px; padding: 0 12px; border: 1px solid #f0cbc8; border-radius: 8px; color: var(--red); background: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 11px; border-bottom: 1px solid #e8ecf1; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #7d8796; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: 13px; }
td code { font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.pagination > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pagination button { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
.pagination button.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.pagination button:disabled { opacity: .45; }
.wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.wallet-grid article:first-child { color: white; border-color: transparent; background: linear-gradient(135deg, #172744, #2456b8); }
.wallet-grid article:first-child span, .wallet-grid article:first-child small { color: rgba(255,255,255,.65); }
.payment-orders-panel { margin-bottom: 16px; }
.amount-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: -7px 0 16px; }
.amount-presets button { min-height: 38px; border: 1px solid #d5dce6; border-radius: 8px; color: var(--blue); background: #f7faff; font-weight: 700; }
.amount-presets button:hover { border-color: var(--blue); }
.payment-security-note { margin: 4px 0 18px; padding: 12px 14px; border-radius: 9px; color: #4f6177; background: #f1f5fb; font-size: 12px; }
.payment-result { position: relative; padding: 32px; text-align: center; }
.payment-result h2 { margin-bottom: 3px; }
.payment-result > p { margin-bottom: 16px; }
.payment-result > small { display: block; margin: 12px auto 18px; max-width: 410px; color: var(--muted); }
.payment-result > code { display: block; color: #778399; font-size: 11px; }
.payment-result .secondary-button { width: 100%; }
.payment-qr-frame { width: 238px; height: 238px; display: grid; place-items: center; margin: 0 auto 14px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 12px 36px rgba(18,42,78,.1); }
.payment-qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.payment-live-status { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 8px; color: #8b641a; font-weight: 700; }
.payment-live-status i { width: 9px; height: 9px; border-radius: 50%; background: #e8a627; box-shadow: 0 0 0 5px rgba(232,166,39,.12); animation: paymentPulse 1.4s infinite; }
.payment-live-status.paid { color: var(--green); }
.payment-live-status.paid i { background: var(--green); animation: none; }
.payment-live-status.failed { color: var(--red); }
.payment-live-status.failed i { background: var(--red); animation: none; }
@keyframes paymentPulse { 50% { opacity: .35; transform: scale(.8); } }
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.docs-nav { position: sticky; top: 125px; align-self: start; display: grid; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.docs-nav a { padding: 7px 0; color: var(--muted); text-decoration: none; }
.docs-content { padding: 30px 34px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.docs-content h3 { margin-top: 35px; font-size: 21px; }
.docs-content h3:first-child { margin-top: 0; }
pre { overflow-x: auto; padding: 18px; border-radius: 10px; color: #dce9ff; background: #101b2f; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.error-codes span { padding: 12px; border-radius: 8px; background: var(--soft); }
.error-codes b { margin-right: 8px; color: var(--blue); }

dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 17px; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(8,17,31,.66); backdrop-filter: blur(4px); }
dialog form, .secret-result { position: relative; padding: 32px; }
dialog h2 { margin: 7px 0 3px; font-size: 26px; }
dialog p { margin: 0 0 22px; color: var(--muted); }
.dialog-close { position: absolute; top: 18px; right: 20px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: var(--soft); font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.secret-result code { display: block; margin: 20px 0 13px; padding: 15px; border: 1px solid #c9d8f7; border-radius: 9px; color: #1d4ed8; background: #eff5ff; overflow-wrap: anywhere; }
.secret-result .primary-button { width: 100%; }
.secret-result .text-button { display: block; margin: 13px auto 0; }
.toast { position: fixed; z-index: 100; right: 28px; bottom: 28px; max-width: 430px; padding: 14px 18px; border-radius: 10px; color: white; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #9a3737; }

@media (max-width: 1180px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 40px; }
  .auth-promise { margin: 80px 0 45px; }
  .auth-panel { padding: 60px 30px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .model-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 13px; }
  .brand-lockup.compact, .sidebar-card, .logout-button { display: none; }
  .sidebar nav { display: flex; }
  .sidebar nav button { width: auto; white-space: nowrap; }
  .workspace { padding: 0 18px 40px; }
  .topbar { min-height: 82px; }
  .dashboard-grid, .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; display: flex; gap: 12px; overflow-x: auto; }
  .model-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .key-row, .invoice-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .auth-brand { padding: 30px 22px; }
  .auth-promise { margin-top: 55px; }
  .auth-promise h1 { font-size: 39px; }
  .promise-grid, .two-columns, .stat-grid, .wallet-grid, .error-codes { grid-template-columns: 1fr; }
  .topbar-actions .service-status { display: none; }
  .hero-strip, .section-heading { align-items: flex-start; flex-direction: column; }
  .key-row, .invoice-row { grid-template-columns: 1fr; }
}
