/* ═══════════ App pages: login, account, admin, agreement, receipt ═══════════ */
body.app { background: radial-gradient(ellipse 90% 60% at 70% -10%, #0e2150 0%, var(--bg) 60%) fixed; min-height: 100vh; }
.app .ic { fill: none; }
.app-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 var(--gutter); background: rgba(5, 9, 20, 0.94); border-bottom: 1px solid var(--line); }
.app-header .brand-logo { height: 22px; }
.app-header .spacer { flex: 1; }
.app-header .who { color: var(--muted); font-size: 14px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { padding-top: 32px; padding-bottom: 80px; }
.app-title { font-size: clamp(26px, 3vw, 36px); margin: 6px 0 6px; }
.app-sub { color: var(--muted); }
.app-empty { max-width: 560px; margin: 60px auto; padding: 40px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.app-empty p { color: var(--muted); }
.demo-banner { position: sticky; top: 0; z-index: 60; padding: 8px 16px; background: #FFB547; color: #1a1000; font-size: 13.5px; text-align: center; font-weight: 600; }
.btn-xs { padding: 7px 12px; font-size: 13px; gap: 6px; }
.btn-danger { background: rgba(255, 77, 109, 0.12); border: 1px solid rgba(255, 77, 109, 0.45); color: #FF9AAD; }
.btn-danger:hover { background: rgba(255, 77, 109, 0.22); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.link { color: var(--cyan); background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 500; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 20px; border-radius: 12px; background: #0f2a1c; border: 1px solid #2f9e66; color: #c9ffe3; font-size: 14.5px; transition: all 0.35s var(--ease); max-width: calc(100vw - 32px); }
.toast.bad { background: #2a0f16; border-color: #c43a57; color: #ffd0da; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; border: 1px solid; }
.tone-muted { color: #c2cad8; border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.08); }
.tone-blue { color: #8db7ff; border-color: rgba(52, 120, 246, 0.5); background: rgba(52, 120, 246, 0.12); }
.tone-amber { color: #FFCB7A; border-color: rgba(255, 181, 71, 0.5); background: rgba(255, 181, 71, 0.1); }
.tone-cyan { color: #7deeff; border-color: rgba(0, 217, 255, 0.5); background: rgba(0, 217, 255, 0.1); }
.tone-green { color: #8ff5c0; border-color: rgba(124, 255, 178, 0.45); background: rgba(124, 255, 178, 0.08); }
.tone-red { color: #ff9aad; border-color: rgba(255, 77, 109, 0.5); background: rgba(255, 77, 109, 0.08); }

/* login */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-card { width: min(460px, 100%); padding: clamp(24px, 4vw, 40px); display: grid; gap: 18px; }
.auth-card h1 { font-size: 28px; }
.auth-card .app-sub { font-size: 14.5px; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(5, 9, 20, 0.7); border: 1px solid var(--line); }
.auth-tabs button { flex: 1; padding: 9px 12px; border-radius: 999px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--grad); color: #00111f; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-google { background: #fff; color: #1f2937; border: 1px solid #e5e7eb; }
.btn-google:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px rgba(255, 255, 255, 0.4); }
.code-input { letter-spacing: 0.5em; font-size: 22px !important; text-align: center; font-family: var(--font-head) !important; }
.auth-foot { font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--cyan); }

/* account */
.acct-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; margin-top: 28px; }
.acct-side { display: grid; gap: 16px; position: sticky; top: 88px; }
.panel { padding: 22px; }
.panel h2, .panel h3 { font-size: 18px; margin-bottom: 14px; }
.panel .muted, .muted { color: var(--muted); font-size: 14px; }
.order-card { padding: 22px; display: grid; gap: 16px; margin-bottom: 16px; }
.order-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.order-top h3 { font-size: 19px; margin-bottom: 4px; }
.order-meta { color: var(--muted); font-size: 13.5px; }
.money { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.money div { padding: 12px; border-radius: 12px; background: rgba(5, 9, 20, 0.5); border: 1px solid var(--line); }
.money span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.money strong { font-family: var(--font-head); font-size: 18px; font-weight: 600; }
.money .disc { color: #8ff5c0; }
.hint { font-size: 13.5px; color: var(--muted); }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.steps-bar { display: flex; gap: 4px; }
.steps-bar i { flex: 1; height: 4px; border-radius: 4px; background: rgba(148, 163, 184, 0.18); }
.steps-bar i.on { background: var(--grad); }
.files { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(5, 9, 20, 0.5); border: 1px solid var(--line); font-size: 13.5px; }
.file-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
details.more > summary { cursor: pointer; color: var(--cyan); font-weight: 600; font-size: 14px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 12px; }
.draft-card { border-color: rgba(255, 181, 71, 0.5); }
.qotd.small { text-align: left; padding: 20px; }
.qotd.small blockquote { font-size: 17px; margin: 10px 0 6px; }
.qotd.small .eyebrow { justify-content: flex-start; font-size: 11px; }

/* admin */
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 24px 0; padding: 5px; border-radius: 14px; background: rgba(5, 9, 20, 0.7); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.admin-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.admin-tabs button[aria-selected="true"] { background: rgba(0, 217, 255, 0.12); color: var(--text); box-shadow: inset 0 0 0 1px rgba(0, 217, 255, 0.4); }
.admin-tabs .count { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--grad); color: #00111f; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { padding: 20px; }
.stat span { display: block; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.stat strong { display: block; font-family: var(--font-head); font-size: 30px; font-weight: 600; margin-top: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(5, 9, 20, 0.6); color: var(--text); }
.toolbar input { min-width: 240px; flex: 1; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: rgba(8, 15, 30, 0.85); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 500; background: rgba(52, 120, 246, 0.07); position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: rgba(0, 217, 255, 0.05); }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.tbl input, .tbl select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(5, 9, 20, 0.6); color: var(--text); }
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 200; width: min(640px, 100vw); background: #08101f; border-left: 1px solid var(--line-strong); box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5); transform: translateX(100%); transition: transform 0.4s var(--ease); overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; background: #08101f; border-bottom: 1px solid var(--line); }
.drawer-head h3 { flex: 1; font-size: 19px; }
.drawer-body { padding: 22px; display: grid; gap: 22px; }
.drawer-body section { display: grid; gap: 12px; }
.drawer-body h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 500; }
.scrim { position: fixed; inset: 0; z-index: 150; background: rgba(2, 5, 12, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ═══════════ Paper documents (agreement, receipt) ═══════════ */
body.doc-page { background: #e9edf3; color: #111827; }
.doc-toolbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 12px; background: #050914; }
.doc-toolbar .btn { padding: 10px 18px; font-size: 14px; }
.paper { width: min(820px, calc(100vw - 24px)); margin: 24px auto 60px; background: #fff; color: #111827; padding: clamp(24px, 6vw, 64px); border-radius: 6px; box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18); font-family: var(--font-body); font-size: 14.5px; line-height: 1.6; }
.paper h1 { font-family: var(--font-head); font-size: 22px; letter-spacing: 0.04em; text-align: center; margin: 22px 0 6px; color: #0A1425; }
.paper h2 { font-family: var(--font-head); font-size: 16px; margin: 24px 0 8px; color: #0A1425; }
.paper p { margin: 6px 0; }
.paper ul { margin: 6px 0 6px 22px; padding: 0; }
.paper li { margin: 3px 0; }
.paper .doc-logo { display: block; width: 260px; height: auto; margin: 0 auto; }
.paper .doc-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-weight: 600; margin-top: 14px; padding: 10px 0; border-top: 2px solid #0A1425; border-bottom: 1px solid #cbd5e1; }
.paper .notice { margin: 18px 0; padding: 14px 18px; border: 1.5px solid #3478F6; border-radius: 8px; background: #f2f7ff; }
.paper .notice strong { display: block; margin-bottom: 4px; color: #1d4ed8; letter-spacing: 0.05em; }
.paper table.info { width: 100%; border-collapse: collapse; margin: 6px 0; }
.paper table.info td { padding: 7px 10px; border: 1px solid #cbd5e1; vertical-align: top; }
.paper table.info td:first-child { width: 38%; background: #f8fafc; font-weight: 600; }
.paper .sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 26px; }
.paper .sign-box { padding: 14px; border: 1px solid #cbd5e1; border-radius: 8px; min-height: 130px; }
.paper .sign-box .sig { font-family: 'Segoe Script', 'Brush Script MT', cursive; font-size: 24px; color: #1d4ed8; margin: 8px 0 2px; min-height: 34px; }
.paper .sign-box .pending { color: #94a3b8; font-style: italic; }
.paper .stamp { font-size: 11.5px; color: #475569; }
.paper .doc-foot { margin-top: 34px; padding-top: 12px; border-top: 1px solid #cbd5e1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 12px; color: #475569; }
.paper .tagline { text-align: center; font-family: 'Segoe Script', 'Brush Script MT', cursive; font-size: 22px; color: #1d4ed8; margin-top: 18px; }
.paper .amount-big { font-family: var(--font-head); font-size: 28px; font-weight: 700; color: #0A1425; }
.paper .paid-stamp { display: inline-block; padding: 4px 14px; border: 2px solid #16a34a; color: #16a34a; border-radius: 6px; font-weight: 700; letter-spacing: 0.15em; transform: rotate(-4deg); }
.sign-panel { width: min(820px, calc(100vw - 24px)); margin: 0 auto 60px; padding: 24px; border-radius: 10px; background: #0A1425; color: var(--text); display: grid; gap: 14px; }
.sign-panel label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.sign-panel input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--cyan); }

@media print {
  @page { size: A4; margin: 14mm; }
  body.doc-page { background: #fff; }
  .doc-toolbar, .sign-panel, .demo-banner, .toast, .file-warning { display: none !important; }
  .paper { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
  .paper h2 { break-after: avoid; }
  .paper .sign-grid, .paper table.info { break-inside: avoid; }
}

@media (max-width: 1023px) {
  .acct-grid { grid-template-columns: minmax(0, 1fr); }
  .acct-side { position: static; }
}
@media (max-width: 640px) {
  .money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .paper .sign-grid { grid-template-columns: minmax(0, 1fr); }
  .app-header .who { display: none; }
}
.toolbar .spacer { flex: 1; }
.list-title { font-size: 20px; }
.panel + .panel { margin-top: 18px; }
.stats + .list-title { margin: 32px 0 14px; }
.policy .panel h2 { font-size: 20px; margin-bottom: 12px; }
.policy .panel { margin-top: 18px; max-width: 860px; }
.policy .check-list li { color: var(--text); }

/* Admin 2FA */
.mfa-card { margin-top: 22px; padding: 22px; display: grid; gap: 14px; border-color: rgba(255, 181, 71, 0.45); }
.mfa-card.ok { border-color: rgba(124, 255, 178, 0.4); }
.mfa-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.mfa-qr { width: 200px; height: 200px; padding: 10px; border-radius: 12px; background: #fff; }
.mfa-secret { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; padding: 8px 10px; border-radius: 8px; background: rgba(5, 9, 20, 0.6); border: 1px solid var(--line); }
.mfa-gate { max-width: 440px; margin: 40px auto; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.diff b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .mfa-grid { grid-template-columns: minmax(0, 1fr); } }
/* 404 page */
.not-found { max-width: 640px; padding-top: clamp(48px, 10vh, 120px); text-align: center; }
.not-found .panel { padding: clamp(32px, 6vw, 56px) clamp(20px, 5vw, 48px); }
.not-found-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
