:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #172033;
  --muted: #6d7688;
  --line: #dfe5ee;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #15803d;
  --warning: #b45309;
  --shadow: 0 14px 34px rgba(28, 39, 60, .09);
  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); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 430px); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 34px 24px; text-align: center; box-shadow: var(--shadow); }
.brand-mark { width: 62px; height: 62px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 20px; background: linear-gradient(145deg, #111827, #334155); color: white; font-weight: 900; font-size: 30px; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(24px, 6vw, 34px); line-height: 1.05; }
h2 { margin-bottom: 14px; font-size: 21px; }
h3 { margin-bottom: 8px; font-size: 16px; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 14px; margin-top: 22px; text-align: left; }

.pin-form { margin-top: 24px; }
.pin-boxes { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.pin-boxes input { width: 54px; height: 62px; border: 1px solid var(--line); border-radius: 16px; text-align: center; font-size: 28px; font-weight: 800; outline: none; background: var(--surface-2); }
.pin-boxes input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); background: white; }

.app-shell { min-height: 100dvh; padding-bottom: 84px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(16px, env(safe-area-inset-top)) 18px 14px; background: rgba(244,246,251,.93); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(223,229,238,.75); }
.topbar h1 { font-size: 24px; margin: 0; }
.view { width: min(100%, 1180px); margin: 0 auto; padding: 18px; }
.chip { display: inline-flex; align-items: center; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; padding: 8px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }

.bottom-nav { position: fixed; z-index: 10; inset: auto 0 0; min-height: 68px; padding: 7px max(10px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(62px, 1fr); gap: 4px; overflow-x: auto; background: rgba(255,255,255,.96); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.nav-button { border: 0; background: transparent; color: var(--muted); border-radius: 13px; padding: 7px 4px; display: grid; gap: 3px; place-items: center; font-size: 11px; font-weight: 700; }
.nav-button .icon { font-size: 20px; }
.nav-button.active { background: #eff6ff; color: var(--brand); }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat strong { display: block; font-size: 26px; margin-bottom: 3px; }
.stat span { color: var(--muted); font-size: 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.section-head h2 { margin: 0; }
.card-list { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 19px; padding: 16px; box-shadow: 0 5px 18px rgba(26,38,58,.04); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card p:last-child { margin-bottom: 0; }
.card.button p { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; margin-top: 9px; }
.compact-history { display: grid; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.compact-history strong { color: var(--text); font-size: 13px; }
.linked-account { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 10px 0; padding: 10px 12px; border-radius: 13px; background: var(--surface-2); font-size: 12px; }
.linked-account span { color: var(--muted); }
.linked-account a { margin-left: auto; }
.bundle-summary { display: grid; gap: 7px; margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); font-size: 12px; }
.bundle-summary div { display: flex; flex-wrap: wrap; gap: 6px; }
.bundle-summary span { padding: 4px 7px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.bundle-members { display: grid; gap: 10px; margin-top: 12px; }
.bundle-member { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.bundle-member .actions, .bundle-member .bundle-secret { grid-column: 1 / -1; }
.ticket-history { display: grid; gap: 10px; margin-top: 10px; }
.ticket-history > div { padding: 10px 12px; border-left: 3px solid var(--brand); border-radius: 8px; background: var(--surface-2); }
.ticket-history strong, .ticket-history span { display: block; }
.ticket-history span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.ticket-history p { margin: 7px 0 0; white-space: pre-wrap; }
.creator-full-card { display: grid; gap: 18px; }
.creator-card-section { display: grid; gap: 8px; }
.creator-card-section h3 { margin: 0; }
.compact-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.compact-row > div { min-width: 0; flex: 1; display: grid; gap: 3px; }
.compact-row span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.detail-grid > div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.detail-grid span { color: var(--muted); font-size: 11px; }
@media (max-width: 520px) { .detail-grid { grid-template-columns: 1fr; } .compact-row { align-items: flex-start; flex-wrap: wrap; } }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; background: var(--surface-2); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.pending_approval { color: #92400e; background: #fef3c7; }
.badge.queued { color: #1d4ed8; background: #dbeafe; }
.badge.offered { color: #6d28d9; background: #ede9fe; }
.badge.assigned, .badge.active { color: #166534; background: #dcfce7; }
.badge.rejected, .badge.cancelled { color: #991b1b; background: #fee2e2; }

.button { appearance: none; border: 1px solid var(--line); border-radius: 13px; padding: 11px 14px; background: var(--surface); color: var(--text); font-weight: 800; }
.button:hover { border-color: #b7c1d0; }
.button.primary { background: var(--brand); border-color: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); }
.button.danger { color: var(--danger); border-color: #fecaca; background: #fff7f7; }
.button.success { color: white; border-color: var(--success); background: var(--success); }
.button.small { padding: 8px 10px; font-size: 12px; }
.button.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.support-issue { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }

label { display: grid; gap: 7px; color: #3d4656; font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--text); border-radius: 13px; padding: 12px 13px; outline: none; }
textarea { min-height: 95px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-card { display: grid; gap: 13px; }
.form-grid { display: grid; gap: 13px; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); border: 1px dashed #cbd5e1; border-radius: 18px; background: rgba(255,255,255,.55); }
.secret { margin-top: 10px; padding: 13px; border-radius: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; overflow-wrap: anywhere; background: #111827; color: #f8fafc; }
.secret-stack { display: grid; gap: 12px; white-space: pre-wrap; }
.secret-stack small { display: block; margin-bottom: 3px; color: #94a3b8; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.compact-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.compact-stats span { display: grid; gap: 2px; color: var(--muted); font-size: 11px; }
.compact-stats strong { color: var(--text); font-size: 20px; }
.notice { border-left: 4px solid var(--brand); background: #eff6ff; padding: 12px 14px; border-radius: 12px; color: #1e3a8a; font-size: 13px; }
.cdek-map { min-height: 360px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; gap: 3px; margin-left: 9px; padding: 0 0 18px 22px; border-left: 2px solid #cbd5e1; }
.timeline-item::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline-item span, .timeline-item small { color: var(--muted); font-size: 12px; }
details { margin-top: 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 750; }
details pre { margin: 10px 0 0; padding: 12px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 11px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 90px; translate: -50% 0; width: min(calc(100% - 28px), 480px); padding: 13px 16px; border-radius: 14px; background: #111827; color: white; box-shadow: var(--shadow); text-align: center; font-weight: 700; }
.toast.error { background: #991b1b; }
.skeleton-card { height: 112px; border-radius: 19px; margin-bottom: 10px; background: linear-gradient(100deg,#e8ecf2 30%,#f8fafc 50%,#e8ecf2 70%); background-size: 300% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position-x: -150%; } }

@media (min-width: 760px) {
  .view { padding: 24px; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-nav { left: 50%; right: auto; width: min(700px, calc(100% - 28px)); transform: translateX(-50%); bottom: 12px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
}
