/* KPU Connect — dark cinematic theme (spec §K, mockup). Mobile-first;
   on wide screens the app sits in a centered 480px frame. */
:root {
  --bg: #0b0d10;
  --bg-elev: #111317;
  --card: #17191d;
  --card-2: #1c1e23;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --blue: #1a6ef5;
  --blue-press: #155bd0;
  --text: #ffffff;
  --muted: #9aa0a8;
  --dim: #6c727b;
  --success: #33c46e;
  --danger: #e5484d;
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; }

.app-frame { position: relative; max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); }
@media (min-width: 520px) { body { background: #05060a; } .app-frame { box-shadow: 0 0 0 1px var(--border); } }

.screen { padding: calc(12px + var(--safe-t)) 18px calc(var(--nav-h) + var(--safe-b) + 24px); animation: fade .18s ease-out; }
.screen.no-nav { padding-bottom: calc(24px + var(--safe-b)); }
.screen.flush { padding-left: 0; padding-right: 0; padding-top: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Header */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; }
.app-header .brand { display: flex; align-items: center; gap: 10px; }
.app-header .brand img { height: 38px; width: auto; }
.app-header .brand span { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.app-header .title { font-size: 20px; font-weight: 700; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #2b6ff0, #163f8f); display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .02em; border: 1px solid var(--border-strong); }
.back-btn { background: rgba(0,0,0,.45); border: 1px solid var(--border-strong); color: #fff; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); }

/* Typography */
.greeting { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
.h1 { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.15; }
.h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.verse { margin: 12px 0 20px; padding: 14px 16px; border-left: 3px solid var(--blue); background: var(--card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.verse p { margin: 0; font-style: italic; font-size: 15px; }
.verse span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.section { margin: 22px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head .link { color: var(--blue); font-size: 14px; font-weight: 600; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.hero-card { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 250px; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; border: 1px solid var(--border); background: var(--card) center/cover no-repeat; isolation: isolate; }
.hero-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,16,.05) 20%, rgba(11,13,16,.55) 60%, rgba(11,13,16,.95) 100%); z-index: -1; }
.hero-card .eyebrow { color: #cfd6e0; }
.hero-card .hero-title { font-size: 24px; font-weight: 800; margin: 6px 0 4px; line-height: 1.15; }
.hero-card .hero-meta { color: #cfd6e0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 14px; }
.hero-card .hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-card .hero-meta svg { width: 15px; height: 15px; opacity: .85; }

.event-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; }
.event-card .thumb { width: 96px; min-height: 100px; background: var(--card-2) center/cover no-repeat; }
.event-card .body { padding: 14px 14px 14px 0; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.event-card .date { color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.event-card .name { font-size: 17px; font-weight: 700; margin: 4px 0 4px; line-height: 1.2; }
.event-card .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-card + .event-card, .list-item + .list-item { margin-top: 12px; }
.group-card { grid-template-columns: 96px 1fr auto; align-items: center; }
.group-card .thumb { align-self: stretch; }
.group-card .body { padding: 14px 0; }
.group-card .date { text-transform: none; letter-spacing: 0; margin-top: 3px; }
.group-card .meta { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 3px; }
.group-card .chev { color: var(--dim); padding-right: 12px; }
.group-card + .group-card { margin-top: 12px; }
.announce { display: flex; gap: 12px; background: rgba(26,110,245,.10); border: 1px solid rgba(26,110,245,.35); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 16px; }
.announce .an-icon { color: #6ea3ff; flex: none; margin-top: 2px; }
.announce .an-icon svg { width: 18px; height: 18px; }
.announce b { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #6ea3ff; margin-bottom: 4px; }
.announce p { margin: 0; font-size: 14.5px; line-height: 1.45; }
.prose { color: var(--text); font-size: 15px; line-height: 1.55; margin: 0 0 4px; white-space: pre-line; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.badge.ok { background: rgba(51,196,110,.15); color: var(--success); }
.badge.muted { background: rgba(255,255,255,.08); color: var(--muted); }
.badge.warn { background: rgba(229,72,77,.14); color: #ff7b7f; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-action { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; min-height: 104px; transition: background .12s; }
.quick-action:active { background: var(--card-2); }
.quick-action .icon { width: 38px; height: 38px; border-radius: 11px; background: rgba(26,110,245,.16); color: #6ea3ff; display: grid; place-items: center; }
.quick-action .icon svg { width: 20px; height: 20px; }
.quick-action .label { font-weight: 700; font-size: 15px; }
.quick-action .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.list-item { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.list-item .li-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--card-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 15px; }
.list-item .li-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-item .chev { color: var(--dim); flex: none; }

/* Menu rows (Profile / More) */
.menu { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-top: 1px solid var(--border); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.menu-row:first-child { border-top: 0; }
.menu-row:active { background: var(--card-2); }
.menu-row .mr-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(26,110,245,.14); color: #6ea3ff; display: grid; place-items: center; flex: none; }
.menu-row .mr-icon svg { width: 18px; height: 18px; }
.menu-row .mr-label { flex: 1; font-weight: 600; font-size: 15px; }
.menu-row .mr-sub { color: var(--muted); font-size: 12.5px; font-weight: 400; display: block; }
.menu-row .chev { color: var(--dim); }
.menu-row.danger .mr-label { color: #ff7b7f; }
.menu-row.danger .mr-icon { background: rgba(229,72,77,.14); color: #ff7b7f; }
.profile-head { display: flex; align-items: center; gap: 16px; padding: 8px 0 22px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 22px; }
.profile-head .name { font-size: 22px; font-weight: 800; }
.profile-head .sub { color: var(--muted); font-size: 14px; }

/* Segmented control */
.segmented { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 0 0 16px; }
.segmented button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; }
.segmented button.active { background: var(--blue); color: #fff; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 12px; padding: 15px 18px; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform .08s, background .12s; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-press); }
.btn-secondary { background: rgba(255,255,255,.08); color: #fff; border: 1px solid var(--border-strong); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: rgba(229,72,77,.14); color: #ff7b7f; border: 1px solid rgba(229,72,77,.3); }
.btn + .btn { margin-top: 10px; }
.btn.inline { width: auto; padding: 10px 16px; font-size: 14px; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--success); font-weight: 700; margin: 6px 0 10px; }
.status-line svg { width: 18px; height: 18px; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.field input { width: 100%; background: var(--card); border: 1px solid var(--border-strong); color: #fff; padding: 14px 14px; border-radius: 12px; font-size: 16px; outline: none; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,110,245,.25); }
.field input.code { text-align: center; letter-spacing: .5em; font-size: 26px; font-weight: 700; }
.field .hint { color: var(--dim); font-size: 12.5px; margin-top: 6px; }
.form-error { background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.3); color: #ff9a9d; padding: 11px 14px; border-radius: 10px; font-size: 14px; margin: 0 0 14px; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; padding: 12px 0; cursor: pointer; font-size: 14px; }
.center { text-align: center; }

/* Empty / skeleton */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--card); display: grid; place-items: center; color: #6ea3ff; }
.empty .icon svg { width: 26px; height: 26px; }
.empty h3 { color: #fff; margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 37%, var(--card) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton.card-sk { height: 110px; margin-bottom: 12px; }
.skeleton.hero-sk { height: 250px; }

/* Splash */
.splash { position: fixed; inset: 0; margin: 0 auto; max-width: 480px; background: var(--bg) center/cover no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; }
.splash::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,16,.35), rgba(11,13,16,.85)); }
.splash > * { position: relative; }
.splash img { width: 150px; height: auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.6)); }
.splash .tag { margin-top: 18px; color: #d5dbe4; letter-spacing: .28em; text-transform: uppercase; font-size: 12px; font-weight: 700; }
.splash .sub { margin-top: 6px; color: var(--muted); font-size: 13px; }

/* Auth */
.auth-hero { height: 240px; background: var(--card) center/cover no-repeat; position: relative; }
.auth-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,16,.1), var(--bg)); }
.auth-hero img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 130px; z-index: 1; }
.auth-body { padding: 0 18px calc(24px + var(--safe-b)); margin-top: -20px; position: relative; }
.auth-body .h1 { font-size: 26px; }
.history-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.history-card .stats { display: flex; gap: 10px; margin-top: 12px; }
.history-card .stat { flex: 1; background: var(--card-2); border-radius: 10px; padding: 12px; text-align: center; }
.history-card .stat b { display: block; font-size: 22px; }
.history-card .stat span { font-size: 12px; color: var(--muted); }

/* Event detail */
.detail-hero { position: relative; height: 300px; background: var(--card) center/cover no-repeat; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,16,.15) 0%, rgba(11,13,16,.2) 50%, var(--bg) 100%); }
.detail-hero .back-btn { position: absolute; left: 16px; top: calc(14px + var(--safe-t)); z-index: 2; }
.detail-body { padding: 0 18px calc(var(--nav-h) + var(--safe-b) + 24px); margin-top: -56px; position: relative; z-index: 1; }
.detail-body .h1 { font-size: 28px; }
.info-grid { display: grid; gap: 10px; margin: 16px 0; }
.info-row { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.info-row .ir-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(26,110,245,.14); color: #6ea3ff; display: grid; place-items: center; flex: none; }
.info-row .ir-icon svg { width: 17px; height: 17px; }
.info-row b { display: block; font-size: 14.5px; }
.info-row span { color: var(--muted); font-size: 13px; }
.cta-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); padding-top: 10px; background: linear-gradient(180deg, transparent, var(--bg) 30%); }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(13,15,19,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); display: flex; z-index: 40; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: #fff; }
.bottom-nav a.active svg { color: var(--blue); }

/* Sheet + toast */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 480px; background: var(--bg-elev); border-radius: 20px 20px 0 0; padding: 14px 20px calc(20px + var(--safe-b)); border-top: 1px solid var(--border-strong); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 0 auto 16px; }
.sheet h3 { margin: 0 0 8px; font-size: 19px; }
.sheet p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); transform: translateX(-50%); background: #23262c; color: #fff; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--border-strong); font-size: 14px; font-weight: 600; z-index: 70; max-width: calc(100% - 36px); box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: up .2s; }
.toast.error { border-color: rgba(229,72,77,.5); }

/* Phase 2 — event actions, in-app e-ticket */
.btn svg { width: 18px; height: 18px; flex: none; }
a.btn { text-decoration: none; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row:empty { display: none; }
.btn-row .btn { flex: 1; padding: 13px 10px; font-size: 14.5px; margin-top: 0; }
.btn-row + .btn { margin-top: 10px; }
.status-line + .btn-row { margin-top: 0; }
.serve-row { margin: 14px 0 0; }
.cta-bar.static { position: static; background: none; padding-top: 16px; }
.ticket-card { background: #fff; color: #0f172a; border-radius: 18px; padding: 20px 18px 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.ticket-card .eyebrow { color: var(--blue); }
.ticket-card .tc-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin-top: 6px; line-height: 1.15; }
.ticket-card .tc-meta { color: #475569; font-size: 13.5px; margin-top: 4px; }
.ticket-card .tc-qr { margin: 18px auto 14px; padding: 10px; background: #fff; border: 1px dashed #cbd5e1; border-radius: 14px; width: 260px; max-width: 100%; }
.ticket-card .tc-qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.ticket-card .tc-name { font-weight: 700; font-size: 17px; }
.ticket-card .muted { color: #64748b; }
.ticket-card .status-line { color: #15803d; }
