/* =====================================================================
   PORPROVKu — PAGES
   Gaya khusus halaman: beranda publik, dashboard, live score, profil
   atlet, venue, laporan. Semua tetap memakai token.
   ===================================================================== */

/* ============================== BERANDA PUBLIK ======================== */
.home-hero {
  position: relative; overflow: hidden; color: var(--n-0);
  border-radius: var(--r-2xl); padding: var(--sp-6);
  background:
    radial-gradient(560px 300px at 88% -20%, rgba(255, 199, 44, .25), transparent 70%),
    linear-gradient(128deg, var(--c-navy-900) 0%, var(--c-navy-700) 52%, #0F62AE 100%);
  box-shadow: var(--sh-lg);
}
.home-hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' fill-opacity='.10' d='M0 64c180 34 340 34 520 0s340-34 520 0 280 30 400 22v54H0z'/%3E%3Cpath fill='%23FFC72C' fill-opacity='.18' d='M0 88c200 26 360 20 560-6s360-26 560 4 240 24 320 18v36H0z'/%3E%3C/svg%3E") bottom / cover no-repeat;
}
.hero-grid { position: relative; z-index: 2; display: grid; grid-template-columns: 1.35fr .65fr; gap: var(--sp-4); align-items: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); font-weight: var(--fw-black); letter-spacing: .16em; color: var(--c-gold-300); text-transform: uppercase; }
.hero-title { font-size: clamp(22px, 3.4vw, 34px); font-weight: var(--fw-black); line-height: var(--lh-tight); letter-spacing: -.6px; margin: var(--sp-2) 0; }
.hero-title span { color: var(--c-gold-300); }
.hero-sub { font-size: var(--fs-sm); color: rgba(255, 255, 255, .82); max-width: 470px; }
.hero-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: 14px;
  padding: 7px 13px; border-radius: var(--r-pill); background: var(--c-gold-300);
  color: var(--c-navy-900); font-weight: var(--fw-black); font-size: var(--fs-sm);
}
.hero-pill .dotlive { width: 7px; height: 7px; border-radius: 50%; background: #C0392B; box-shadow: 0 0 0 3px rgba(192, 57, 43, .2); animation: blink 1.4s infinite; }
.hero-actions { display: flex; gap: 9px; margin-top: var(--sp-4); flex-wrap: wrap; }
.hero-figure { justify-self: end; text-align: center; }
.hero-figure img { width: 100%; max-width: 210px; margin: 0 auto; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .35)); }
.hero-stats {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-top: 22px; padding-top: var(--sp-4);
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.hero-stat b { display: block; font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--n-0); line-height: 1.2; }
.hero-stat span { font-size: var(--fs-2xs); color: rgba(255, 255, 255, .72); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

.quick-card { background: var(--surface); border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--sh-md); padding: var(--sp-4); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 14px var(--sp-2); border-radius: var(--r-md); background: var(--n-25);
  border: 1px solid #E8F0F8; font-size: var(--fs-sm); font-weight: var(--fw-bold);
  color: var(--brand-ink); text-align: center; min-height: 96px;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.quick-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(7, 50, 96, .1); border-color: #CFE1F2; }
.qt-ico { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--n-0); }
.qt-ico svg { width: 23px; height: 23px; }
.qt-ico.blue { background: linear-gradient(140deg, #1E6FBE, var(--c-navy-700)); }
.qt-ico.gold { background: linear-gradient(140deg, #FFD24D, #E5A500); color: #3B2A00; }
.qt-ico.green { background: linear-gradient(140deg, #1CB86C, #0C7F4A); }
.qt-ico.red { background: linear-gradient(140deg, #E5564B, #B32A22); }
.qt-ico.violet { background: linear-gradient(140deg, #7C6BE0, #4A3AAE); }
.qt-ico.teal { background: linear-gradient(140deg, #18AAB2, #067C88); }
.qt-ico.slate { background: linear-gradient(140deg, #55708C, #2C4258); }

/* ================================ FILTER BAR ========================== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; box-shadow: var(--sh-md); margin-bottom: var(--sp-4);
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1 1 140px; }
.filter-field label { font-size: var(--fs-2xs); font-weight: var(--fw-black); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--muted); }
.filter-field input, .filter-field select { min-height: 38px; padding: 7px 10px; font-size: var(--fs-sm); background-color: var(--n-25); }
.filter-actions { display: flex; gap: 6px; align-items: center; }
.filter-quick { display: flex; gap: 6px; align-items: center; width: 100%; flex-wrap: wrap; }

/* ================================ KPI ================================ */
.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.kpi-grid .stat-card { padding: 14px; }
.monitor-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.grid-stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.medal-strip {
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: 14px;
  background: linear-gradient(120deg, var(--c-navy-900), var(--c-navy-700) 62%, #0F62AE);
  border-radius: var(--r-lg); padding: 14px var(--sp-4); color: var(--n-0); box-shadow: var(--sh-md);
}
.medal-tile { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-right: 1px solid rgba(255, 255, 255, .14); }
.medal-tile:last-of-type { border-right: 0; }
.medal-tile .mt-ico { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.medal-tile.tone-gold .mt-ico { background: rgba(255, 199, 44, .22); color: #FFD24D; }
.medal-tile.tone-silver .mt-ico { background: rgba(255, 255, 255, .16); color: #E7EEF6; }
.medal-tile.tone-bronze .mt-ico { background: rgba(205, 127, 50, .24); color: #F0C69B; }
.medal-tile.tone-blue .mt-ico { background: rgba(62, 150, 219, .22); color: #9CCDF3; }
.medal-tile b { display: block; font-size: var(--fs-xl); font-weight: var(--fw-black); line-height: 1.1; }
.medal-tile span { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: rgba(255, 255, 255, .7); }
.medal-strip-link {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-navy-900);
  background: var(--c-gold-300); padding: var(--sp-2) 13px; border-radius: var(--r-md); min-height: 38px;
}
.medal-strip-link svg { width: 15px; height: 15px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--sp-4); margin-top: var(--sp-4); align-items: start; }

/* ================================ GRAFIK ============================== */
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: var(--sp-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-semibold); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend-inline { display: flex; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }
.chart-legend-inline i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-navy { background: var(--c-navy-700); }
.dot-green { background: var(--c-green-600); }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-svg { position: relative; flex: 0 0 auto; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-size: var(--fs-2xl); font-weight: var(--fw-black); color: var(--brand-ink); line-height: 1; }
.donut-center span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.donut-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 1; }
.donut-legend li { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend span { flex: 1; color: var(--muted); }
.donut-legend b { font-weight: var(--fw-black); color: var(--brand-ink); }

/* ============================ LIVE SCORE ============================== */
.live-badge, .live-indicator {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--r-pill); background: var(--c-green-100); color: var(--c-green-700);
  font-size: var(--fs-xs); font-weight: var(--fw-black);
}
.live-badge i, .live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-green-600); animation: pulse 1.8s infinite; }
.live-indicator.stale { background: var(--c-amber-100); color: var(--c-amber-700); }
.live-indicator.stale i { background: var(--c-amber-600); animation: none; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 164, 94, .5); } 50% { box-shadow: 0 0 0 5px rgba(18, 164, 94, 0); } }

.live-board {
  position: relative; overflow: hidden; color: var(--n-0); border-radius: var(--r-xl);
  padding: var(--sp-5); box-shadow: var(--sh-lg);
  background:
    radial-gradient(600px 260px at 85% -10%, rgba(255, 199, 44, .2), transparent 70%),
    linear-gradient(135deg, var(--c-navy-900), var(--c-navy-700) 60%, #0F62AE);
}
.live-board .lb-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.live-board .lb-comp { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-gold-300); letter-spacing: .04em; }
.live-board .lb-main { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-4); align-items: center; margin: var(--sp-5) 0; }
.live-board .lb-team { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.live-board .lb-team.right { align-items: flex-end; text-align: right; }
.live-board .lb-name { font-size: var(--fs-lg); font-weight: var(--fw-black); line-height: 1.2; }
.live-board .lb-sub { font-size: var(--fs-xs); color: rgba(255, 255, 255, .65); }
.live-board .lb-score { font-size: clamp(34px, 6vw, 54px); font-weight: var(--fw-black); letter-spacing: 2px; line-height: 1; font-variant-numeric: tabular-nums; }
.live-board .lb-time { font-size: var(--fs-xs); color: rgba(255, 255, 255, .7); text-align: center; margin-top: 6px; }
.live-board .lb-foot { display: flex; gap: var(--sp-3); flex-wrap: wrap; padding-top: var(--sp-3); border-top: 1px solid rgba(255, 255, 255, .16); font-size: var(--fs-xs); color: rgba(255, 255, 255, .75); }
.live-board .lb-empty { text-align: center; padding: var(--sp-8) var(--sp-4); }
.live-board .lb-empty svg { width: 40px; height: 40px; opacity: .5; margin: 0 auto var(--sp-3); }
.score-flash { animation: scoreFlash 1.2s var(--ease); }
@keyframes scoreFlash { 0% { color: var(--c-gold-300); transform: scale(1.12); } 100% { color: inherit; transform: none; } }
.live-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-2); align-items: center;
  padding: 10px 0; border-bottom: 1px solid #F1F6FA;
}
.live-row:last-child { border-bottom: 0; }

/* ============================ PROFIL ATLET ============================ */
.athlete-hero { display: grid; grid-template-columns: 220px 1fr; gap: var(--sp-5); align-items: start; }
.athlete-photo {
  aspect-ratio: 3/4; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(140deg, var(--c-navy-700), var(--c-blue-600));
  display: grid; place-items: center; color: rgba(255, 255, 255, .7);
  font-size: 56px; font-weight: var(--fw-black); border: 1px solid var(--line); box-shadow: var(--sh-md);
}
.athlete-photo img { width: 100%; height: 100%; object-fit: cover; }
.athlete-name { font-size: var(--fs-3xl); font-weight: var(--fw-black); color: var(--brand-ink); line-height: var(--lh-tight); }
.athlete-meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.athlete-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-4); }
.athlete-stat { background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px var(--sp-3); }
.athlete-stat b { display: block; font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--brand-ink); }
.athlete-stat span { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted); }

/* ============================== LAPORAN =============================== */
.report-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ============================== PWA / INSTALL ========================= */
.install-bar {
  display: none; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4);
  background: var(--c-blue-100); border: 1px solid #CFE2F5; border-radius: var(--r-md);
  font-size: var(--fs-sm); color: #14538F; margin-bottom: var(--sp-4);
}
.install-bar.show { display: flex; }
.install-bar svg { width: 20px; height: 20px; flex: 0 0 auto; }
.offline-pill {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottomnav-h) + 12px);
  z-index: var(--z-toast); background: var(--n-900); color: var(--n-0);
  padding: 8px 14px; border-radius: var(--r-pill); font-size: var(--fs-xs);
  font-weight: var(--fw-bold); box-shadow: var(--sh-lg); display: none;
}
.offline-pill.show { display: block; }

/* ============================== RESPONSIF ============================= */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { display: none; }
  .auth-side { display: none; }
  .auth-page { grid-template-columns: 1fr; }
  .athlete-hero { grid-template-columns: 160px 1fr; }
}
@media (max-width: 900px) {
  .home-hero { padding: var(--sp-4); border-radius: var(--r-lg); }
  .hero-stats { grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
  .hero-stat b { font-size: var(--fs-lg); }
  .hero-stat span { font-size: 9px; }
  .quick-grid { gap: var(--sp-2); }
  .quick-tile { padding: var(--sp-3) 4px; font-size: var(--fs-xs); min-height: 84px; }
  .qt-ico { width: 38px; height: 38px; }
  .quick-tile .qt-ico svg { width: 20px; height: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-grid .stat-card { padding: var(--sp-3); gap: 9px; }
  .kpi-grid .stat-ico { width: 38px; height: 38px; }
  .kpi-grid .stat-value { font-size: var(--fs-xl); }
  .kpi-grid .stat-sub { display: none; }
  .monitor-grid { grid-template-columns: repeat(2, 1fr); }
  .medal-strip { gap: var(--sp-2); padding: var(--sp-3); }
  .medal-tile { border-right: 0; padding: 2px var(--sp-2) 2px 0; flex: 1 1 40%; }
  .medal-tile b { font-size: var(--fs-lg); }
  .medal-strip-link { margin-left: 0; width: 100%; justify-content: center; }
  .dash-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
  .filter-bar { padding: var(--sp-3); gap: var(--sp-2); }
  .filter-field { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .tbl-toolbar { padding: 11px var(--sp-3); }
  .tbl-search { max-width: none; }
  .tbl-export { width: 100%; }
  .tbl-export .btn { flex: 1; }
  .tbl-filters { padding: 10px var(--sp-3); }
  .tbl-filter { flex: 1 1 calc(50% - 8px); }
  .tbl-filter select { width: 100%; min-width: 0; }
  .tbl-foot { padding: 10px var(--sp-3); }
  .tbl-foot .pagination { width: 100%; justify-content: space-between; }
  .donut-wrap { justify-content: center; }
  .news-grid { grid-template-columns: 1fr; }
  .team-name { font-size: var(--fs-sm); }
  .score { font-size: var(--fs-lg); }
  .athlete-hero { grid-template-columns: 1fr; }
  .athlete-photo { max-width: 170px; aspect-ratio: 1; font-size: 40px; }
  .athlete-name { font-size: var(--fs-2xl); }
  .live-board .lb-name { font-size: var(--fs-base); }
  .live-board .lb-score { font-size: 34px; }
  .confirm-wrap { margin: var(--sp-3) auto; }
  .toast-region { right: var(--sp-3); left: var(--sp-3); bottom: calc(var(--bottomnav-h) + 10px); width: auto; }
  dialog.palette { margin-top: 8vh; }
  .modal-body { max-height: 58vh; }
}
@media (max-width: 480px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .athlete-stats { grid-template-columns: 1fr 1fr; }
}

/* Badge panjang di dalam baris sempit tidak boleh meluber */
@media (max-width: 900px) {
  .live-board .lb-top { align-items: flex-start; }
  .live-board .badge { max-width: 46%; }
}
