/* =====================================================================
   SINERGI FUTSAL ACADEMY — DESIGN SYSTEM
   Tema: Modern Sports Academy · Prinsip: CEPAT -> SEDERHANA -> MUDAH
   Acuan: docs/06-design-system.md
   ===================================================================== */

:root {
  /* Warna inti */
  --brand:        #0b6b3a;
  --brand-strong: #075130;
  --brand-soft:   #e6f4ec;
  --brand-ink:    #ffffff;
  --accent:       #f59e0b;
  --accent-soft:  #fef3c7;

  --ink:     #0f172a;
  --ink-2:   #475569;
  --ink-3:   #94a3b8;
  --bg:      #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line:    #e2e8f0;
  --line-2:  #cbd5e1;

  /* Status absensi (§7) */
  --st-hadir:     #16a34a;
  --st-terlambat: #eab308;
  --st-izin:      #3b82f6;
  --st-sakit:     #ef4444;
  --st-alpa:      #334155;

  /* Semantik */
  --ok:    #16a34a;
  --warn:  #eab308;
  --danger:#ef4444;
  --info:  #3b82f6;

  --trend-up:   #16a34a;
  --trend-flat: #64748b;
  --trend-down: #ef4444;

  /* Spasi & bentuk */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --r-sm: 8px;  --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  --sh-1: 0 1px 2px rgba(15,23,42,.06);
  --sh-2: 0 2px 8px rgba(15,23,42,.08);
  --sh-3: 0 8px 24px rgba(15,23,42,.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-num:  "SF Mono", "Segoe UI Mono", "Roboto Mono", ui-monospace, monospace;

  --sidebar-w: 248px;
  --bottomnav-h: 60px;
  --header-h: 60px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #22c07a;  --brand-strong: #16a565; --brand-soft: #12281e; --brand-ink: #04140c;
    --accent: #fbbf24; --accent-soft: #3a2c07;
    --ink: #e8edf4; --ink-2: #a9b6c6; --ink-3: #7c8a9c;
    --bg: #0b1016; --surface: #141b24; --surface-2: #1b2430;
    --line: #26313f; --line-2: #33404f;
    --sh-1: 0 1px 2px rgba(0,0,0,.4);
    --sh-2: 0 2px 8px rgba(0,0,0,.45);
    --sh-3: 0 8px 24px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  --brand: #22c07a;  --brand-strong: #16a565; --brand-soft: #12281e; --brand-ink: #04140c;
  --accent: #fbbf24; --accent-soft: #3a2c07;
  --ink: #e8edf4; --ink-2: #a9b6c6; --ink-3: #7c8a9c;
  --bg: #0b1016; --surface: #141b24; --surface-2: #1b2430;
  --line: #26313f; --line-2: #33404f;
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 8px rgba(0,0,0,.45);
  --sh-3: 0 8px 24px rgba(0,0,0,.55);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3,h4,p,figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-soft); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------- boot/loading */
.app-loading { min-height: 100vh; display: grid; place-items: center; }
.boot { text-align: center; color: var(--ink-2); padding: 24px; }
.boot-logo { color: var(--brand); display: flex; justify-content: center; margin-bottom: 12px; }
.boot-name { font-size: 19px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.boot-tag { font-size: 12.5px; margin-top: 4px; color: var(--ink-3); }
.boot-spinner {
  width: 26px; height: 26px; margin: 20px auto 0; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================================================================
   LAYOUT
   ================================================================= */
.layout { display: flex; min-height: 100vh; }

/* ---- Sidebar (desktop) */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--line);
  display: none; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px var(--sp-5); border-bottom: 1px solid var(--line);
}
.sidebar-brand svg { color: var(--brand); flex: 0 0 auto; }
.sidebar-brand .name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.sidebar-brand .sub  { font-size: 10.5px; color: var(--ink-3); letter-spacing: .03em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-3) var(--sp-6); }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px var(--sp-3); border-radius: var(--r-md); border: 0; background: none;
  color: var(--ink-2); font-size: 14px; font-weight: 500; text-align: left;
  border-left: 3px solid transparent; transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; border-left-color: var(--brand); }
.nav-item svg { flex: 0 0 auto; }
.nav-item .badge-dot {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: var(--r-full); display: grid; place-items: center; padding: 0 5px;
}
.sidebar-foot { border-top: 1px solid var(--line); padding: var(--sp-3); }

/* ---- Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-4); height: var(--header-h);
  padding-top: env(safe-area-inset-top);
}
.topbar .t-title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .t-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-md); border: 0; background: none;
  color: var(--ink-2); display: grid; place-items: center; position: relative; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: var(--r-full); display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.content {
  flex: 1; padding: var(--sp-4); max-width: 1320px; width: 100%; margin: 0 auto;
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 20px);
}

/* ---- Bottom nav (mobile) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  border: 0; background: none; color: var(--ink-3);
  height: var(--bottomnav-h); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600;
  position: relative;
}
.bn-item.active { color: var(--brand); }
.bn-item .dot {
  position: absolute; top: 8px; right: calc(50% - 20px);
  min-width: 15px; height: 15px; padding: 0 4px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; border-radius: var(--r-full); display: grid; place-items: center;
}

@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .bottomnav { display: none; }
  .content { padding: var(--sp-6); padding-bottom: var(--sp-10); }
  .hide-desktop { display: none !important; }
}
@media (max-width: 1023px) {
  .hide-mobile { display: none !important; }
}

/* =================================================================
   KOMPONEN
   ================================================================= */

/* ---- Card */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--sp-4);
}
@media (min-width: 768px) { .card { padding: var(--sp-5); } }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; }
.card-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 500; }

.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: var(--sp-2);
}

/* ---- Grid */
.grid { display: grid; gap: var(--sp-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1023px) {
  .g-main { grid-template-columns: 1fr; }
  .g-4, .g-6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px) {
  .grid { gap: var(--sp-3); }
  .g-2, .g-3, .g-4, .g-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-2.stack-sm, .g-3.stack-sm { grid-template-columns: 1fr; }
}

/* ---- Stat card */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-4); box-shadow: var(--sh-1); min-width: 0;
}
.stat .label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.stat .value {
  font: 800 30px/1.1 var(--font-num); font-variant-numeric: tabular-nums;
  margin-top: 6px; letter-spacing: -.02em;
}
.stat .delta { font-size: 12px; font-weight: 700; margin-top: 4px; }
.stat.brand { background: linear-gradient(140deg, var(--brand), var(--brand-strong)); border-color: transparent; color: #fff; }
.stat.brand .label, .stat.brand .value { color: #fff; }
.stat.brand .label { opacity: .85; }
@media (max-width: 620px) { .stat .value { font-size: 24px; } }

/* ---- Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 var(--sp-4); border-radius: var(--r-md);
  border: 1px solid transparent; font-size: 14px; font-weight: 650;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .06s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-accent { background: var(--accent); color: #3b2500; }
.btn-sm { min-height: 34px; padding: 0 var(--sp-3); font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; min-height: 50px; font-size: 15px; }
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* Tombol simpan sticky di mobile */
.sticky-save {
  position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  padding: var(--sp-4) 0 var(--sp-2); margin-top: var(--sp-4); z-index: 20;
}
@media (min-width: 1024px) { .sticky-save { bottom: 0; } }

/* ---- Badge & chip */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: var(--r-full); font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge.brand   { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.ok      { background: #dcfce7; color: #15803d; border-color: transparent; }
.badge.warn    { background: #fef9c3; color: #a16207; border-color: transparent; }
.badge.danger  { background: #fee2e2; color: #b91c1c; border-color: transparent; }
.badge.info    { background: #dbeafe; color: #1d4ed8; border-color: transparent; }
.badge.neutral { background: var(--surface-2); color: var(--ink-2); }
.badge.accent  { background: var(--accent-soft); color: #92400e; border-color: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.ok     { background: #052e16; color: #4ade80; }
  :root:not([data-theme="light"]) .badge.warn   { background: #2e2205; color: #fcd34d; }
  :root:not([data-theme="light"]) .badge.danger { background: #350d0d; color: #fca5a5; }
  :root:not([data-theme="light"]) .badge.info   { background: #0b1f3d; color: #93c5fd; }
}

.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { height: 0; }
.chip {
  flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---- Progress */
.progress { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: var(--r-full); transition: width .35s var(--ease); }
.progress.lg { height: 10px; }
.bar-row { display: flex; align-items: center; gap: var(--sp-3); }
.bar-row .lbl { flex: 0 0 92px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.bar-row .progress { flex: 1; }
.bar-row .val { flex: 0 0 38px; text-align: right; font: 700 13px var(--font-num); font-variant-numeric: tabular-nums; }

/* ---- Avatar */
.avatar {
  width: 44px; height: 44px; border-radius: var(--r-md); object-fit: cover;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: 0 0 auto;
  overflow: hidden;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; border-radius: var(--r-sm); }
.avatar.lg { width: 76px; height: 76px; font-size: 26px; border-radius: var(--r-lg); }
.avatar.xl { width: 104px; height: 104px; font-size: 34px; border-radius: var(--r-xl); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- List row */
.row-list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left;
  color: inherit; transition: background .12s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .rmain { flex: 1; min-width: 0; }
.row .rtitle { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rsub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rend { flex: 0 0 auto; text-align: right; display: flex; align-items: center; gap: var(--sp-2); }

/* ---- Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); }
table.data { font-size: 13.5px; min-width: 560px; }
table.data th {
  text-align: left; padding: 10px var(--sp-3); background: var(--surface-2);
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---- Form */
.field { margin-bottom: var(--sp-4); }
.field > label {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px;
}
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px var(--sp-3);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  font-size: 15px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.input.err, .select.err, .textarea.err { border-color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.field .error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 600; }
.field-row { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-row.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 620px) { .field-row, .field-row.c3 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: 0 0 auto; margin-top: 1px; }
.check span { font-size: 14px; }

/* ---- Stepper nilai 1-10 */
.stepper { display: flex; align-items: center; gap: var(--sp-2); }
.stepper button {
  width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font-size: 19px; font-weight: 700;
  display: grid; place-items: center; flex: 0 0 auto;
}
.stepper button:hover { background: var(--surface-2); }
.stepper .val {
  min-width: 42px; text-align: center; font: 800 18px var(--font-num);
  font-variant-numeric: tabular-nums;
}
.stepper input[type=range] { flex: 1; accent-color: var(--brand); min-width: 60px; height: 26px; }

.rate-item {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--sp-3);
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.rate-item:last-child { border-bottom: 0; }
.rate-item .rl { min-width: 0; }
.rate-item .rl .n { font-size: 14px; font-weight: 600; }
.rate-item .rl .d { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.rate-item .prev { font-size: 11.5px; color: var(--ink-3); font-family: var(--font-num); }
@media (max-width: 620px) {
  .rate-item { grid-template-columns: 1fr; gap: var(--sp-2); }
}

/* ---- Chip absensi (§7) */
.att-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.att-chip {
  min-height: 44px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink-3);
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: all .12s var(--ease);
}
.att-chip .mark { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .45; }
.att-chip.on .mark { opacity: 1; background: #fff; }
.att-chip.on { color: #fff; border-color: transparent; }
.att-chip[data-s="hadir"].on     { background: var(--st-hadir); }
.att-chip[data-s="terlambat"].on { background: var(--st-terlambat); color: #422006; }
.att-chip[data-s="terlambat"].on .mark { background: #422006; }
.att-chip[data-s="izin"].on      { background: var(--st-izin); }
.att-chip[data-s="sakit"].on     { background: var(--st-sakit); }
.att-chip[data-s="alpa"].on      { background: var(--st-alpa); }
.att-chip[data-s="hadir"]     { color: var(--st-hadir); }
.att-chip[data-s="terlambat"] { color: #a16207; }
.att-chip[data-s="izin"]      { color: var(--st-izin); }
.att-chip[data-s="sakit"]     { color: var(--st-sakit); }
.att-chip[data-s="alpa"]      { color: var(--ink-2); }

.att-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---- Tabs */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  flex: 0 0 auto; scroll-snap-align: start;
  padding: 11px var(--sp-4); border: 0; background: none; color: var(--ink-3);
  font-size: 13.5px; font-weight: 650; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- Empty & loading */
.empty { text-align: center; padding: var(--sp-10) var(--sp-4); color: var(--ink-3); }
.empty svg { color: var(--line-2); margin: 0 auto 12px; }
.empty h3 { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 380px; margin: 0 auto 16px; line-height: 1.6; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-card { height: 96px; border-radius: var(--r-lg); }

/* ---- Toast */
.toast-wrap {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px));
}
@media (min-width: 1024px) { .toast-wrap { left: auto; right: 24px; top: 24px; bottom: auto; transform: none; } }
.toast {
  background: var(--ink); color: var(--bg); padding: 12px var(--sp-4); border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-3);
  display: flex; align-items: center; gap: 10px;
  animation: toastin .22s var(--ease);
}
.toast.ok     { background: #14532d; color: #dcfce7; }
.toast.error  { background: #7f1d1d; color: #fee2e2; }
.toast.info   { background: #1e3a8a; color: #dbeafe; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* ---- Modal / sheet */
.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .18s var(--ease); backdrop-filter: blur(2px);
}
@media (min-width: 768px) { .overlay { align-items: center; padding: var(--sp-6); } }
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--surface); width: 100%; max-width: 620px;
  border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh;
  display: flex; flex-direction: column; animation: sheetup .25s var(--ease);
  box-shadow: var(--sh-3);
}
@media (min-width: 768px) { .modal { border-radius: var(--r-xl); max-height: 88vh; } }
.modal.wide { max-width: 880px; }
@keyframes sheetup { from { transform: translateY(24px); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-foot {
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line);
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
}
.modal-foot .btn { flex: 1; }
@media (min-width: 768px) { .modal-foot .btn { flex: 0 0 auto; min-width: 120px; } }

/* ---- Utilitas */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-1{margin-top:var(--sp-1)} .mt-2{margin-top:var(--sp-2)} .mt-3{margin-top:var(--sp-3)}
.mt-4{margin-top:var(--sp-4)} .mt-5{margin-top:var(--sp-5)} .mt-6{margin-top:var(--sp-6)}
.mb-2{margin-bottom:var(--sp-2)} .mb-3{margin-bottom:var(--sp-3)} .mb-4{margin-bottom:var(--sp-4)}
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny  { font-size: 11.5px; }
.bold  { font-weight: 700; }
.num   { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.trend-up   { color: var(--trend-up); }
.trend-flat { color: var(--trend-flat); }
.trend-down { color: var(--trend-down); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.divider { height: 1px; background: var(--line); margin: var(--sp-4) 0; }

/* =================================================================
   HALAMAN KHUSUS
   ================================================================= */

/* ---- Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .login-page { grid-template-columns: 1.05fr 1fr; } }
.login-hero {
  display: none; padding: var(--sp-10);
  background: linear-gradient(150deg, #075130, #0b6b3a 55%, #0a8a4a);
  color: #fff; flex-direction: column; justify-content: center; position: relative; overflow: hidden;
}
.login-hero::after {
  content: ''; position: absolute; right: -110px; bottom: -110px;
  width: 380px; height: 380px; border-radius: 50%; border: 46px solid rgba(255,255,255,.07);
}
@media (min-width: 900px) { .login-hero { display: flex; } }
.login-hero .lh-logo { margin-bottom: var(--sp-6); }
.login-hero h1 { font-size: 34px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.login-hero p { margin-top: var(--sp-4); opacity: .9; font-size: 15px; max-width: 420px; line-height: 1.65; }
.philosophy { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--sp-8); position: relative; z-index: 1; }
.philosophy span {
  background: rgba(255,255,255,.16); padding: 7px 14px; border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6); background: var(--bg);
}
.login-card { width: 100%; max-width: 390px; }
.login-card .mobile-brand { text-align: center; margin-bottom: var(--sp-6); }
@media (min-width: 900px) { .login-card .mobile-brand { display: none; } }
.login-card .mobile-brand svg { color: var(--brand); margin: 0 auto 10px; }
.login-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-card .lead { color: var(--ink-3); font-size: 13.5px; margin-bottom: var(--sp-6); }
.login-alert {
  background: #fee2e2; color: #991b1b; padding: 11px var(--sp-3); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; margin-bottom: var(--sp-4);
}
.demo-accounts {
  margin-top: var(--sp-6); padding: var(--sp-4); background: var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: var(--r-md); font-size: 12.5px;
}
.demo-accounts .t { font-weight: 700; margin-bottom: 8px; color: var(--ink-2); }
.demo-accounts button {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0;
  background: none; border-radius: var(--r-sm); color: var(--ink-2); font-size: 12.5px;
}
.demo-accounts button:hover { background: var(--surface); color: var(--ink); }
.demo-accounts b { color: var(--ink); }

/* ---- Player card */
.player-card {
  display: flex; gap: var(--sp-3); align-items: flex-start; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-4); box-shadow: var(--sh-1);
  transition: box-shadow .15s var(--ease), transform .06s var(--ease);
}
.player-card:hover { box-shadow: var(--sh-2); }
.player-card:active { transform: scale(.995); }
.player-card .pc-main { flex: 1; min-width: 0; }
.player-card .pc-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card .pc-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.player-card .pc-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.player-card .pc-att { margin-top: 10px; }

/* ---- Profil pemain */
.profile-head { display: flex; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.profile-head .ph-main { flex: 1; min-width: 200px; }
.profile-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.profile-head .ph-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.profile-head .ph-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.7; }
.kv { display: grid; grid-template-columns: 118px minmax(0,1fr); gap: 6px var(--sp-3); font-size: 13.5px; }
.kv dt { color: var(--ink-3); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 600; }

/* ---- Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: var(--sp-5); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--line);
}
.tl-item.type-discipline::before { background: var(--warn); }
.tl-item.type-milestone::before  { background: var(--accent); }
.tl-item.type-match::before      { background: var(--info); }
.tl-item.type-attendance::before { background: var(--danger); }
.tl-date { font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.tl-title { font-weight: 650; font-size: 14px; margin-top: 2px; }
.tl-desc { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.55; }

/* ---- Kalender */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-head div {
  text-align: center; font-size: 10.5px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em; padding: 4px 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); padding: 5px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-size: 12.5px; position: relative; min-height: 44px;
}
.cal-day.out { opacity: .34; }
.cal-day.today { border-color: var(--brand); border-width: 2px; font-weight: 800; color: var(--brand); }
.cal-day.has { background: var(--surface-2); }
.cal-day .marks { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cal-day .mk { width: 6px; height: 6px; border-radius: 50%; }
.mk.latihan { background: var(--brand); }
.mk.pertandingan { background: var(--accent); }
.mk.libur { background: var(--ink-3); }
.mk.tes { background: var(--info); }
.cal-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: var(--sp-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- Chart */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: var(--sp-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---- Filter bar */
.filterbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.filterbar .input, .filterbar .select { min-height: 40px; font-size: 14px; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-wrap .input { padding-left: 40px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--sp-3); }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 11px;
  background: var(--brand-soft); color: var(--brand); border-radius: var(--r-full);
  font-size: 12px; font-weight: 650;
}
.filter-pill button { border: 0; background: none; color: inherit; padding: 0 4px; font-size: 15px; line-height: 1; }

/* ---- Radar */
.radar-wrap { display: flex; justify-content: center; }
.radar-wrap svg { max-width: 340px; }

/* ---- Saran frasa membangun */
.phrase-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.phrase-list button {
  border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--ink-2);
  border-radius: var(--r-full); padding: 6px 11px; font-size: 12px; font-weight: 600; text-align: left;
}
.phrase-list button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ---- Info banner */
.note-box {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  padding: var(--sp-3) var(--sp-4); border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 13px; color: var(--ink-2); line-height: 1.6;
}
.note-box.warn   { background: #fef9c3; border-left-color: var(--warn); color: #713f12; }
.note-box.danger { background: #fee2e2; border-left-color: var(--danger); color: #7f1d1d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note-box.warn   { background: #2a2206; color: #fde68a; }
  :root:not([data-theme="light"]) .note-box.danger { background: #300f0f; color: #fecaca; }
}

/* ---- Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: var(--sp-3); }
.media-item { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.media-item img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.media-item .cap { padding: 8px 10px; font-size: 12px; color: var(--ink-2); }
.media-item .cap .p { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

/* ---- Sheet menu (MORE) */
.sheet-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.sheet-menu button {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: var(--sp-4) var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 650; text-align: center;
}
.sheet-menu button:hover { border-color: var(--brand); color: var(--brand); }
.sheet-menu button svg { color: var(--brand); }

/* ---- Roster absensi */
.roster-item {
  display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.roster-item:last-child { border-bottom: 0; }
.roster-item .ri-main { flex: 1; min-width: 120px; }
.roster-item .ri-name { font-weight: 650; font-size: 14px; }
.roster-item .ri-sub { font-size: 12px; color: var(--ink-3); }
.roster-item .ri-ctrl { flex: 1 1 100%; }
@media (min-width: 760px) {
  .roster-item { flex-wrap: nowrap; }
  .roster-item .ri-ctrl { flex: 0 0 340px; }
}
.att-summary { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: 12.5px; font-weight: 650; }
.att-summary span { display: inline-flex; align-items: center; gap: 5px; }

/* ---- Peringkat kecil */
.rank-row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 0; }
.rank-row .rk {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--ink-2); flex: 0 0 auto;
}
.rank-row .rk.top { background: var(--accent); color: #3b2500; }

/* ---- Pemilih foto pemain (core/photo.js) */
.photo-picker { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.photo-picker.drag .pp-preview { border-color: var(--brand); background: var(--brand-soft); }
.photo-picker.busy { opacity: .6; pointer-events: none; }

.pp-preview {
  position: relative; width: 132px; height: 132px; border-radius: var(--r-xl);
  border: 2px dashed var(--line-2); background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.pp-preview:hover { border-color: var(--brand); }
.pp-preview img { width: 100%; height: 100%; object-fit: cover; }
.pp-preview .pp-ini {
  font-size: 40px; font-weight: 800; color: var(--brand); opacity: .5; line-height: 1;
}
.pp-preview .pp-overlay {
  position: absolute; inset: auto 0 0 0; padding: 7px 4px;
  background: rgba(15, 23, 42, .72); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; opacity: 0;
  transition: opacity .15s var(--ease);
}
.pp-preview:hover .pp-overlay,
.pp-preview:focus-visible .pp-overlay { opacity: 1; }
@media (hover: none) { .pp-preview .pp-overlay { opacity: 1; } }

.pp-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.pp-hint {
  font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.5;
  max-width: 240px; min-height: 32px;
}
.pp-hint.ok  { color: var(--ok); font-weight: 600; }
.pp-hint.err { color: var(--danger); font-weight: 600; }

/* Avatar yang bisa diklik untuk ganti foto (halaman profil pemain) */
.avatar-editable { position: relative; cursor: pointer; }
.avatar-editable::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: rgba(15, 23, 42, .5); opacity: 0; transition: opacity .15s var(--ease);
}
.avatar-editable .ae-badge {
  position: absolute; right: -4px; bottom: -4px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; border: 2px solid var(--surface);
  box-shadow: var(--sh-2);
}
.avatar-editable:hover::after { opacity: 1; }
