/* Dolan Bareng — Pemilihan Kursi Bus */
:root {
  --orange: #F97316;
  --orange-d: #EA580C;
  --orange-l: #FFF1E6;
  --yellow: #FACC15;
  --yellow-l: #FEF9C3;
  --navy: #0F1E4A;
  --navy-2: #1E3A8A;
  --ink: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --bg: #FFFBF5;
  --white: #fff;
  --pending: #9CA3AF;
  --confirmed: #111827;
  --ok: #16A34A;
  --danger: #DC2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,30,74,.06), 0 6px 20px rgba(15,30,74,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.5;
}
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--navy-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.page { max-width: 560px; margin: 0 auto; padding: 16px 14px 140px; }

/* Hero */
.hero { text-align: center; padding: 8px 4px 16px; }
.hero-logo { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto 6px; }
.logo-text { font-weight: 800; font-size: 26px; color: var(--navy); }
.hero h1 { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 8px 0 0; color: var(--navy); font-weight: 600; font-size: 15px; }
.hero-meta span { background: var(--white); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--white); border-radius: 12px; padding: 10px 4px; text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--navy); }
.stat b { display: block; font-size: 24px; font-weight: 800; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.ok { border-color: var(--yellow); }
.stat.wait { border-color: var(--pending); }
.stat.done { border-color: var(--confirmed); }

/* How to */
.howto { background: var(--yellow-l); border: 1px solid #FDE68A; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.howto summary { font-weight: 800; color: var(--navy); cursor: pointer; font-size: 16px; }
.howto ol { margin: 8px 0 2px; padding-left: 22px; }
.howto li { margin: 3px 0; }

/* Card */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.live { font-size: 12px; color: var(--ok); font-weight: 600; }
.live.off { color: var(--danger); }

/* Bus */
.bus { border: 4px solid var(--navy); border-radius: 26px 26px 18px 18px; padding: 14px 10px 10px; background: #FAFAFA; }
.bus-front { display: flex; justify-content: space-between; align-items: flex-start; }
.front-left, .front-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.front-right { align-items: flex-end; }
.tag { border: 2px solid var(--navy); background: var(--white); border-radius: 8px; padding: 3px 12px; font-weight: 700; font-size: 14px; color: var(--navy); }
.tag.door { background: var(--yellow); }
.wheel { width: 38px; height: 38px; color: var(--navy); }
.front-divider { display: flex; justify-content: flex-end; margin: 8px 0 12px; }
.front-divider span { display: block; width: 48%; height: 4px; background: var(--navy); border-radius: 2px; }
.seat-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,.62fr) minmax(0,1fr) minmax(0,1fr); gap: 10px 6px; }
.seat-grid > * { min-width: 0; }
.aisle { min-height: 10px; }
.seat {
  position: relative; min-height: 60px; border-radius: 10px 10px 8px 8px; border: 2px solid #9CA3AF;
  background: var(--white); color: var(--navy); cursor: pointer; padding: 4px 2px 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform .08s ease, background .15s ease, box-shadow .15s; -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 -4px 0 rgba(15,30,74,.06);
}
.seat .num { font-size: 21px; font-weight: 800; line-height: 1; }
.seat .nm { font-size: 10.5px; font-weight: 600; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.seat:active { transform: scale(.95); }
.seat:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 2px; }
.seat.available:hover { border-color: var(--orange); }
.seat.pending { background: var(--pending); border-color: var(--pending); color: #fff; }
.seat.confirmed { background: var(--confirmed); border-color: var(--confirmed); color: #fff; }
.seat.selected { background: var(--orange); border-color: var(--orange-d); color: #fff; box-shadow: 0 0 0 3px rgba(249,115,22,.3); }
.seat.flash { animation: flash .8s ease 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 5px rgba(220,38,38,.5); } }
.bus-rear { text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 14px; font-size: 14px; font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 8px; }
.lg { width: 24px; height: 20px; border-radius: 5px; display: inline-block; flex: none; border: 2px solid transparent; }
.lg.available { background: #fff; border-color: #9CA3AF; }
.lg.selected { background: var(--orange); }
.lg.pending { background: var(--pending); }
.lg.confirmed { background: var(--confirmed); }

.share-row { display: flex; gap: 8px; margin-top: 14px; }
.share-row .btn { flex: 1; }

/* Buttons */
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; cursor: pointer; min-height: 48px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-d); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--orange-d); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-light { background: #F3F4F6; color: var(--ink); }
.btn-ghost { background: var(--white); color: var(--navy); border: 2px solid var(--navy); }
.btn-danger { background: #FEE2E2; color: var(--danger); }
.btn-ok { background: #DCFCE7; color: #166534; }
.btn-big { font-size: 17px; padding: 14px 20px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }

/* Selection bar */
.select-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--navy); color: #fff; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(0,0,0,.18); }
.select-bar > * { max-width: 560px; margin: 0 auto; }
.sb-info { font-size: 15px; margin-bottom: 8px; }
.sb-info b { color: var(--yellow); font-size: 18px; }
.sb-actions { display: flex; gap: 8px; }
.sb-actions .btn-primary { flex: 2; }
.sb-actions .btn-light { flex: 1; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15,30,74,.55); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal-box { background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease; }
@media (min-width: 640px) { .modal { align-items: center; padding: 20px; } .modal-box { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.modal-box h3 { font-size: 20px; margin-bottom: 4px; }
.modal-box.center { text-align: center; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.big-icon { font-size: 48px; }
.field { margin-top: 14px; }
.field label { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.field .chip { background: var(--orange); color: #fff; border-radius: 8px; padding: 2px 10px; font-weight: 800; }
.field .rm { margin-left: auto; background: none; border: 0; color: var(--danger); font-weight: 700; cursor: pointer; font-size: 14px; padding: 4px; }
.input { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; background: #fff; color: var(--ink); }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.input.err { border-color: var(--danger); }
.err-text { color: var(--danger); font-size: 13px; margin-top: 4px; font-weight: 600; }
.summary { margin: 14px 0 6px; text-align: left; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.summary div { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.summary div:first-child { border-top: 0; }
.summary b { min-width: 72px; color: var(--navy); }
.seat-badge { display: inline-flex; width: 64px; height: 64px; border-radius: 14px; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; margin-bottom: 8px; border: 2px solid #9CA3AF; }
.seat-badge.pending { background: var(--pending); color: #fff; border-color: var(--pending); }
.seat-badge.confirmed { background: var(--confirmed); color: #fff; border-color: var(--confirmed); }

/* My requests */
.req { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.req-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.req-item { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill.pending { background: #F3F4F6; color: #4B5563; }
.pill.approved, .pill.confirmed { background: #111827; color: #fff; }
.pill.rejected, .pill.cancelled { background: #FEE2E2; color: var(--danger); }
.pill.available { background: #fff; color: var(--ink); border: 1px solid #9CA3AF; }
.pill.guest { background: var(--orange-l); color: var(--orange-d); }
.pill.admin { background: #E0E7FF; color: var(--navy-2); }

/* Toast */
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 90; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 28px); text-align: center; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* Spinner */
.spin { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* Credit */
.credit { text-align: center; color: var(--muted); font-size: 13px; padding: 22px 10px 10px; }
.credit strong { color: var(--navy); }
.credit .heart { color: #E11D48; }

@media (max-width: 360px) {
  .seat .num { font-size: 18px; }
  .seat .nm { font-size: 9.5px; }
  .seat-grid { gap: 8px 4px; }
  .stat b { font-size: 20px; }
}

/* Cetak */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; }
  .page { padding: 0; max-width: 100%; }
  .howto, .share-row, .select-bar, .modal, .toast, .live, #my-requests, .no-print { display: none !important; }
  .card { box-shadow: none; padding: 0; }
  .stat { box-shadow: none; border: 1px solid #ddd; }
  .hero-logo { max-width: 240px; }
  .bus { max-width: 420px; margin: 0 auto; }
  .seat, .lg, .seat-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .seat { min-height: 50px; }
  .seat .nm { font-size: 9px; white-space: normal; }
  .credit { padding-top: 10px; }
}

/* Navigasi atas */
.topnav { position: sticky; top: 0; z-index: 30; display: flex; justify-content: center; gap: 6px; padding: 8px 10px; background: rgba(255,251,245,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav a { flex: 1; max-width: 220px; text-align: center; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 15px; padding: 10px 8px; border-radius: 999px; background: var(--white); border: 2px solid var(--line); }
.topnav a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.rundown-link { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; text-decoration: none; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.rundown-link .rl-ico { font-size: 28px; }
.rundown-link b { display: block; font-size: 17px; color: var(--yellow); }
.rundown-link small { display: block; font-size: 13px; color: #E2E8F0; }
.rundown-link .rl-go { margin-left: auto; font-size: 30px; font-weight: 700; color: var(--yellow); }

/* Rundown */
.banner-late { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--yellow), #FDBA74); color: var(--navy); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; font-weight: 800; font-size: 16px; line-height: 1.3; border: 2px dashed var(--navy); }
.banner-late .bl-ico { font-size: 30px; animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-6deg); } }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: 25px; top: 52px; bottom: 0; width: 3px; background: repeating-linear-gradient(to bottom, var(--orange) 0 6px, transparent 6px 11px); }
.tl-item:last-child::before { display: none; }
.tl-ico { width: 52px; height: 52px; border-radius: 16px; background: var(--orange-l); color: var(--orange-d); display: flex; align-items: center; justify-content: center; border: 2px solid #FED7AA; position: relative; z-index: 1; }
.tl-ico .ico { width: 26px; height: 26px; }
.tl-body { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.tl-time { display: inline-block; font-weight: 800; color: var(--navy); background: var(--yellow-l); border-radius: 8px; padding: 2px 10px; font-size: 15px; }
.tl-time small { font-weight: 600; color: var(--muted); font-size: 12px; }
.tl-title { font-weight: 700; font-size: 17px; margin-top: 4px; color: var(--ink); }
.tl-desc { color: var(--muted); font-size: 14px; margin-top: 2px; white-space: pre-line; }
.tl-item.hl .tl-ico { background: var(--orange); color: #fff; border-color: var(--orange-d); box-shadow: 0 0 0 5px rgba(249,115,22,.2); }
.tl-item.hl .tl-body { border: 2px solid var(--orange); background: #FFF7ED; }
.tl-item.hl .tl-time { background: var(--orange); color: #fff; }
.tl-item.hl .tl-time small { color: #FFEDD5; }
.hl-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 800; color: #fff; background: #DC2626; border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.note { font-size: 13px; color: var(--muted); background: #F9FAFB; border-radius: 10px; padding: 8px 12px; margin-top: 14px; }
.info-grid { display: grid; gap: 12px; }
.info-card { display: flex; gap: 14px; align-items: flex-start; border-radius: 14px; padding: 14px; border: 1px solid var(--line); }
.info-card .ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.info-card.water { background: #EFF6FF; border-color: #BFDBFE; }
.info-card.water .ic { background: #DBEAFE; }
.info-card.money { background: #F0FDF4; border-color: #BBF7D0; }
.info-card.money .ic { background: #DCFCE7; }
.info-card h3 { font-size: 16px; margin-bottom: 2px; }
.info-card p { margin: 0; font-size: 15px; }
.amount { font-size: 34px; font-weight: 800; color: #15803D; line-height: 1.1; margin: 2px 0 4px; letter-spacing: -.01em; }
@media print { .topnav, .rundown-link { display: none !important; } .tl-ico, .tl-item.hl .tl-body, .banner-late, .info-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.modal-actions .btn-big { flex: 2; }
