:root {
  --navy: #061936;
  --navy-soft: #0b2852;
  --blue: #263c97;
  --cyan: #26c7bf;
  --gold: #ffc000;
  --ink: #172234;
  --muted: #6d7685;
  --line: #dfe5ec;
  --surface: #f4f7fa;
  --white: #ffffff;
  --danger: #b53a4b;
  --success: #16845f;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(6, 25, 54, .1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface); }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { height: 72px; padding: 0 clamp(24px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--navy); font-weight: 760; letter-spacing: -.02em; }
.brand img { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; box-shadow: 0 5px 16px rgba(6,25,54,.16); }
.topnav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.topnav form { margin: 0; }
.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px 0; }

.message-stack { position: fixed; top: 86px; right: 24px; z-index: 30; }
.message { padding: 12px 16px; background: var(--navy); color: white; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: rise .35s ease-out both; }

.auth-page { min-height: 100vh; background: var(--navy); }
.auth-page .topbar { background: transparent; border-color: rgba(255,255,255,.12); position: absolute; width: 100%; }
.auth-page .brand { color: white; }
.auth-shell { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(420px, .84fr); color: white; overflow: hidden; }
.auth-intro { padding: 150px clamp(40px, 8vw, 120px) 72px; position: relative; display: flex; flex-direction: column; justify-content: center; isolation: isolate; }
.auth-intro::before { content: ""; position: absolute; width: 560px; height: 560px; right: -110px; bottom: -240px; border: 110px solid rgba(38,199,191,.2); transform: rotate(45deg); z-index: -1; }
.auth-intro::after { content: "ZK"; position: absolute; right: -18px; top: 90px; font-size: clamp(180px, 24vw, 420px); line-height: 1; font-weight: 900; color: rgba(255,255,255,.035); letter-spacing: -.14em; z-index: -1; }
.eyebrow, .section-label { margin: 0 0 14px; color: var(--cyan); letter-spacing: .18em; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.auth-intro h1 { font-size: clamp(44px, 6vw, 86px); max-width: 760px; line-height: 1.02; letter-spacing: -.055em; margin: 0 0 24px; }
.auth-intro > p:not(.eyebrow) { color: rgba(255,255,255,.68); max-width: 540px; line-height: 1.8; font-size: 17px; }
.steps { list-style: none; padding: 0; margin: 52px 0 0; display: grid; gap: 18px; color: rgba(255,255,255,.76); }
.steps li { display: flex; gap: 18px; align-items: center; }
.steps span { color: var(--gold); font: 700 12px/1 ui-monospace, SFMono-Regular, monospace; letter-spacing: .12em; }
.security-note { margin-top: 52px; display: flex; flex-direction: column; gap: 6px; padding-left: 18px; border-left: 3px solid var(--gold); }
.security-note span { color: rgba(255,255,255,.64); }
.auth-form-panel { color: var(--ink); background: white; padding: 150px clamp(42px, 7vw, 110px) 72px; display: flex; flex-direction: column; justify-content: center; box-shadow: -30px 0 80px rgba(0,0,0,.12); }
.auth-form-panel .section-label { color: var(--blue); }
.auth-form-panel h2 { font-size: 36px; margin: 0 0 36px; letter-spacing: -.035em; }

.stack-form { display: grid; gap: 10px; }
.stack-form label { margin-top: 10px; color: #3e4858; font-size: 13px; font-weight: 700; }
.stack-form input, .stack-form select { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; color: var(--ink); background: #fbfcfd; outline: none; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.stack-form input:focus, .stack-form select:focus { border-color: var(--blue); background: white; box-shadow: 0 0 0 4px rgba(38,60,151,.1); }
.primary-button, .secondary-button { min-height: 50px; border-radius: 10px; padding: 0 20px; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-weight: 760; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 10px 24px rgba(38,60,151,.22); margin-top: 16px; }
.primary-button:hover { transform: translateY(-1px); background: #1e3180; box-shadow: 0 14px 30px rgba(38,60,151,.28); }
.secondary-button { background: white; border: 1px solid var(--line); color: var(--ink); }
.form-foot { color: var(--muted); margin: 22px 0 0; font-size: 14px; }
.field-error, .form-error { color: var(--danger); font-size: 13px; }
.form-error { padding: 12px 14px; background: #fff4f5; border-left: 3px solid var(--danger); margin-bottom: 12px; }

.workspace { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 90px; animation: rise .5s ease-out both; }
.narrow-workspace { width: min(760px, calc(100% - 48px)); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.page-heading h1 { margin: 0 0 10px; color: var(--navy); font-size: clamp(38px, 4.5vw, 64px); line-height: 1; letter-spacing: -.055em; }
.page-heading p:last-child { margin: 0; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 760; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--success); background: #e8f7f1; }
.status-pending { color: #9a6c00; background: #fff6d8; }
.status-suspended, .status-error { color: var(--danger); background: #fff0f2; }
.status-rejected { color: var(--muted); background: #e9edf1; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); padding: 30px 0; border-bottom: 1px solid var(--line); }
.metrics > div { padding: 4px 28px; border-right: 1px solid var(--line); }
.metrics > div:first-child { padding-left: 0; }
.metrics > div:last-child { border-right: 0; }
.metrics span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.metrics strong { color: var(--navy); font-size: 26px; letter-spacing: -.035em; }

.two-column { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 52px; padding: 52px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading h2, .invite-panel h2 { margin: 0; color: var(--navy); font-size: 28px; letter-spacing: -.035em; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.subscription-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.subscription-box p { grid-column: 1 / -1; color: var(--muted); margin: 0; font-size: 13px; }
.subscription-box code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; padding: 14px 16px; border-radius: 9px; background: #eaf0f5; color: #334158; }
.subscription-box .primary-button { margin: 0; }
.client-guides { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 26px; }
.client-guides div { display: grid; gap: 7px; padding-right: 24px; }
.client-guides strong { color: var(--navy); }
.client-guides span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.qr-panel { padding-left: 34px; border-left: 1px solid var(--line); }
.qr-panel img { width: 210px; height: 210px; background: white; padding: 10px; border-radius: 14px; box-shadow: var(--shadow); }
.qr-panel p:last-child { color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty-state { padding: 36px; background: white; border-left: 4px solid var(--gold); }
.empty-state p { color: var(--muted); margin-bottom: 0; }
.usage-section { padding-top: 50px; }
.usage-list { display: grid; gap: 12px; }
.usage-list > div { display: grid; grid-template-columns: 60px 1fr 100px; gap: 18px; align-items: center; }
.usage-list time, .usage-list strong { font-size: 13px; }
.usage-list strong { text-align: right; }
progress { width: 100%; height: 7px; appearance: none; border: 0; }
progress::-webkit-progress-bar { background: #dfe6ed; border-radius: 10px; }
progress::-webkit-progress-value { background: var(--cyan); border-radius: 10px; }
.muted { color: var(--muted); }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 52px; padding: 52px 0; border-bottom: 1px solid var(--line); }
.review-grid { align-items: start; }
.review-list { border-top: 1px solid var(--line); }
.review-row { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(430px, 1.3fr) auto; gap: 18px; align-items: end; padding: 20px 0; border-bottom: 1px solid var(--line); }
.review-identity { display: grid; gap: 5px; }
.review-identity strong { color: var(--navy); font-size: 16px; }
.review-identity span, .review-identity small { color: var(--muted); }
.approval-form { display: grid; grid-template-columns: minmax(230px, 1fr) auto; gap: 10px; align-items: end; }
.approval-form label { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 700; }
.approval-form select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: 0 10px; }
.approve-button { min-height: 40px; color: white; border-color: var(--blue); background: var(--blue); }
.approve-button:hover { color: white; background: #1e3180; }
.reject-form { padding-bottom: 1px; }
.empty-review { display: grid; gap: 6px; padding: 34px 0; color: var(--muted); }
.empty-review strong { color: var(--navy); }
.plan-panel { padding-left: 34px; border-left: 1px solid var(--line); }
.plan-panel h2 { margin: 0 0 22px; color: var(--navy); font-size: 28px; letter-spacing: -.035em; }
.plan-list { border-top: 1px solid var(--line); }
.plan-list > div { display: grid; gap: 5px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.plan-list strong { color: var(--navy); }
.plan-list span { color: var(--blue); font-size: 13px; font-weight: 700; }
.plan-list small { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-weight: 650; text-align: left; padding: 0 14px 12px; border-bottom: 1px solid var(--line); }
td { padding: 17px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td:first-child, th:first-child { padding-left: 0; }
td strong, td span { display: block; }
td span:not(.status) { color: var(--muted); font-size: 11px; margin-top: 4px; }
.inline-action { margin: 0; }
.compact-button { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 760; padding: 7px 10px; white-space: nowrap; }
.compact-button:hover { border-color: var(--blue); }
.danger-button { color: var(--danger); }
.danger-button:hover { border-color: var(--danger); }
.pending-copy { color: var(--muted); line-height: 1.8; margin: 0 0 10px; }
.pending-panel .primary-button { align-self: start; }
.download-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 52px; padding-top: 52px; }
.download-group { margin-bottom: 44px; }
.bootstrap-card { margin: 0 0 48px; padding: 30px; background: var(--navy); color: white; border-top: 4px solid var(--gold); box-shadow: var(--shadow); }
.bootstrap-card h2 { margin: 6px 0 12px; font-size: 30px; }
.bootstrap-card p { color: rgba(255,255,255,.78); line-height: 1.75; }
.bootstrap-card small { display: block; margin-top: 16px; color: rgba(255,255,255,.62); line-height: 1.6; }
.bootstrap-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.bootstrap-actions .compact-button { display: inline-flex; align-items: center; color: white; border-color: rgba(255,255,255,.35); background: transparent; }
.download-row { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; gap: 18px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.download-row > div:first-child { display: grid; gap: 5px; }
.download-row strong { color: var(--navy); }
.download-row span { color: var(--muted); font-size: 12px; }
.download-meta { display: flex; gap: 14px; }
.download-button { color: white; border-color: var(--blue); background: var(--blue); }
.download-row details { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.download-row summary { cursor: pointer; }
.download-row code { display: block; margin-top: 8px; overflow-wrap: anywhere; }
.ios-panel { padding-left: 34px; border-left: 1px solid var(--line); }
.ios-panel h2 { margin: 0 0 18px; color: var(--navy); font-size: 30px; }
.ios-panel p { color: var(--muted); line-height: 1.75; }
.ios-panel .primary-button { margin: 12px 0 18px; }
.ios-panel small { display: block; color: var(--muted); line-height: 1.7; }
.ios-panel hr { margin: 34px 0; border: 0; border-top: 1px solid var(--line); }
.invite-panel { padding-left: 34px; border-left: 1px solid var(--line); }
.invite-panel h2 { margin-bottom: 22px; }
.invite-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.invite-list > div { background: var(--surface); padding: 18px; display: grid; gap: 6px; }
.invite-list span { color: var(--blue); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
.invite-list small { color: var(--muted); }

.reveal-box { background: white; margin: 38px 0 24px; padding: 34px; border-top: 4px solid var(--gold); box-shadow: var(--shadow); display: grid; gap: 16px; }
.reveal-box span { color: var(--muted); font-size: 12px; }
.reveal-box code { font-size: clamp(22px, 4vw, 38px); color: var(--navy); letter-spacing: .05em; overflow-wrap: anywhere; }
.reveal-box .primary-button { justify-self: start; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 520px; padding-top: 130px; }
  .auth-form-panel { padding-top: 72px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics > div:nth-child(2) { border-right: 0; }
  .metrics > div { padding: 16px 18px; }
  .two-column, .admin-grid, .download-layout { grid-template-columns: 1fr; }
  .qr-panel, .invite-panel, .plan-panel, .ios-panel { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 34px; }
  .review-row { grid-template-columns: 1fr; align-items: stretch; }
  .approval-form { grid-template-columns: 1fr auto; }
}

@media (max-width: 640px) {
  .topbar { height: 64px; padding: 0 18px; }
  .brand span { display: none; }
  .brand img { width: 38px; height: 38px; }
  .auth-intro { min-height: 470px; padding: 116px 24px 54px; }
  .auth-intro h1 { font-size: 48px; }
  .steps { margin-top: 34px; }
  .auth-form-panel { padding: 58px 24px 52px; }
  .workspace, .narrow-workspace { width: min(100% - 32px, 1440px); padding-top: 38px; }
  .page-heading { align-items: start; }
  .page-heading h1 { font-size: 40px; }
  .metrics strong { font-size: 21px; }
  .metrics > div:nth-child(odd) { padding-left: 0; }
  .client-guides { grid-template-columns: 1fr; gap: 18px; }
  .subscription-box { grid-template-columns: 1fr; }
  .subscription-box .primary-button { width: 100%; }
  .invite-list { grid-template-columns: 1fr; }
  .approval-form { grid-template-columns: 1fr; }
  .download-row { grid-template-columns: 1fr auto; }
  .download-row .download-meta { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
