/* ==========================================================================
   SwimTracker v3.1 — style.css
   Design tokens + komponen. Tanpa build step, tanpa CDN.
   Acuan: Design.md §2 (tokens) dan §4 (komponen reusable)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET & BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }

table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: 6px;
}

.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;
}

/* --------------------------------------------------------------------------
   2. DESIGN TOKENS (Design.md §2)
   -------------------------------------------------------------------------- */
:root {
  /* 2.1 Warna inti */
  --primary-600: #2563EB;
  --primary-700: #1D4ED8;
  --primary-500: #3B82F6;
  --sidebar-from: #1E5FD8;
  --sidebar-to: #3B82F6;
  --aqua: #06B6D4;
  --bg-app: #F3F6FB;
  --bg-card: #FFFFFF;
  --border: #E5EAF2;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --bg-hero-from: #EAF2FF;
  --bg-hero-to: #DCEBFF;

  /* 2.2 Warna status */
  --ok: #16A34A;
  --ok-tint: #DCFCE7;
  --warn: #D97706;
  --warn-tint: #FEF3C7;
  --bad: #DC2626;
  --bad-tint: #FEE2E2;
  --info: #2563EB;
  --info-tint: #DBEAFE;
  --purple: #7C3AED;
  --purple-tint: #EDE9FE;
  --gold: #F59E0B;
  --gold-tint: #FEF3C7;
  --gray: #6B7280;
  --gray-tint: #F3F4F6;

  /* 2.3 Warna level */
  --level-1: #FF8C00;   --level-1-tint: #FFF1DB;
  --level-2: #2ECC71;   --level-2-tint: #DDF7E8;
  --level-3: #3498DB;   --level-3-tint: #DEEEFA;
  --level-4: #FF69B4;   --level-4-tint: #FFE3F0;
  --level-5: #8E44AD;   --level-5-tint: #EEDFF5;

  /* Tipografi */
  --font-sans: "Inter", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-hero: 30px;
  --fs-h1: 22px;
  --fs-title: 19px;
  --fs-card: 15px;
  --fs-kpi: 30px;
  --fs-body: 14px;
  --fs-sm: 13px;
  --fs-label: 12px;
  --fs-cap: 11px;

  /* Spacing */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px;

  /* Radius */
  --r-card: 14px;
  --r-ctl: 10px;
  --r-pill: 999px;
  --r-box: 12px;
  --r-lg: 16px;

  /* Shadow */
  --sh-card: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-hover: 0 4px 12px rgba(16, 24, 40, .08);
  --sh-pop: 0 10px 30px rgba(16, 24, 40, .12);
  --ring: rgba(37, 99, 235, .25);
  --overlay: rgba(15, 23, 42, .45);

  /* Layout */
  --sidebar-w: 230px;
  --topbar-h: 64px;
  --t: 170ms cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --------------------------------------------------------------------------
   3. LAYOUT HELPERS
   -------------------------------------------------------------------------- */
.row      { display: flex; align-items: center; gap: var(--s3); }
.row-top  { display: flex; align-items: flex-start; gap: var(--s3); }
.row-wrap { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.wrap     { flex-wrap: wrap; }  /* utility: bungkus baris fleksibel (dipakai di banyak halaman) */
.col      { display: flex; flex-direction: column; gap: var(--s3); }
.col-tight{ display: flex; flex-direction: column; gap: var(--s2); }
.spread   { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grow     { flex: 1 1 auto; min-width: 0; }
.ml-auto  { margin-left: auto; }
.g1 { gap: var(--s1); } .g2 { gap: var(--s2); } .g3 { gap: var(--s3); }
.g4 { gap: var(--s4); } .g5 { gap: var(--s5); } .g6 { gap: var(--s6); }

.g1p { display: grid; gap: var(--s1); }
.g2p { display: grid; gap: var(--s2); }
.g3p { display: grid; gap: var(--s3); }
.g4p { display: grid; gap: var(--s4); }
.g5p { display: grid; gap: var(--s5); }
.g6p { display: grid; gap: var(--s6); }

.t2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.t3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.t5  { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.t-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.ta-r { text-align: right; } .ta-c { text-align: center; }

.hide { display: none !important; }

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY HELPERS
   -------------------------------------------------------------------------- */
.t-hero  { font-size: var(--fs-hero);  font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.t-h1    { font-size: var(--fs-h1);    font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.t-title { font-size: var(--fs-title); font-weight: 600; }
.t-card  { font-size: var(--fs-card);  font-weight: 600; }
.t-body  { font-size: var(--fs-body); }
.t-sm    { font-size: var(--fs-sm); }
.t-label { font-size: var(--fs-label); font-weight: 500; }
.t-cap   { font-size: var(--fs-cap); }
.t-secondary { color: var(--text-secondary); }
.t-muted { color: var(--text-muted); }
.t-ok    { color: var(--ok); }
.t-warn  { color: var(--warn); }
.t-bad   { color: var(--bad); }
.t-link  { font-size: var(--fs-sm); font-weight: 600; color: var(--primary-600); }
.t-link:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 600; }
.upper { text-transform: uppercase; letter-spacing: .04em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   5. APP SHELL (Design.md §3)
   -------------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.shell-main { display: flex; flex-direction: column; min-width: 0; }

/* 5.1 Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sb-brand {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s5) var(--s4);
  color: #fff; text-decoration: none;
}
.sb-brand:hover { text-decoration: none; color: #fff; }
.sb-logo {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  display: grid; place-items: center;
  flex-shrink: 0; overflow: hidden;
}
.sb-name { display: block; font-size: 16px; font-weight: 700; line-height: 1.1; }
.sb-sub { display: block; font-size: 10.5px; color: rgba(255, 255, 255, .7); letter-spacing: .02em; }

.sb-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s2) var(--s3) var(--s4);
  scrollbar-width: thin;
}
.sb-group {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255, 255, 255, .55);
  padding: var(--s4) var(--s3) var(--s2);
}
.sb-group:first-child { padding-top: var(--s1); }

.sb-item {
  display: flex; align-items: center; gap: var(--s3);
  height: 42px; padding: 0 var(--s3);
  border-radius: var(--r-ctl);
  color: rgba(255, 255, 255, .92);
  font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t);
}
.sb-item:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.sb-item svg { flex-shrink: 0; opacity: .9; }
.sb-item.active {
  background: #fff; color: var(--primary-600);
  font-weight: 600;
  box-shadow: var(--sh-card);
}
.sb-item.active svg { opacity: 1; }
.sb-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .22);
  font-size: var(--fs-cap); font-weight: 700;
  display: grid; place-items: center;
}
.sb-item.active .sb-badge { background: var(--bad); color: #fff; }
.sb-badge.amber { background: rgba(245, 158, 11, .95); color: #fff; }

.sb-foot {
  padding: var(--s3);
  border-top: 1px solid rgba(255, 255, 255, .18);
}
.sb-logout {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; height: 42px; padding: 0 var(--s3);
  border-radius: var(--r-ctl);
  color: rgba(255, 255, 255, .95);
  font-size: var(--fs-sm); font-weight: 500;
}
.sb-logout:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* 5.2 Topbar */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s6);
  position: sticky; top: 0; z-index: 30;
}
.tb-title { font-size: var(--fs-title); font-weight: 600; line-height: 1.15; }
.tb-crumb { font-size: var(--fs-cap); color: var(--text-secondary); }

.hamburger { display: none; width: 38px; height: 38px; border-radius: var(--r-ctl); color: var(--text-secondary); }
.hamburger:hover { background: #F1F5F9; }

.search-pill {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--s2);
  height: 38px; padding: 0 var(--s4);
  background: #F1F5F9; border-radius: var(--r-pill);
  color: var(--text-muted); font-size: var(--fs-sm);
  min-width: 260px;
  text-decoration: none;
}
.search-pill:hover { background: #E8EEF7; text-decoration: none; }

.tb-actions { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-ctl);
  display: grid; place-items: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--t);
  position: relative;
}
.icon-btn:hover { background: #F1F5F9; text-decoration: none; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bad); border: 2px solid #fff;
}
.icon-btn .dot.amber { background: var(--warn); }

/* 5.1 Panel notifikasi (dropdown dari lonceng topbar) */
.notif-panel {
  position: absolute;
  top: 62px; right: var(--s5);
  width: min(360px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--sh-pop);
  z-index: 45;
  overflow: hidden;
  animation: pop var(--t);
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  background: #FCFDFE;
}
.notif-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: 11px var(--s4);
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: background var(--t);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: #F8FAFC; text-decoration: none; }
.notif-item .grow { min-width: 0; display: grid; }
.notif-item b { font-size: var(--fs-sm); font-weight: 600; }
.notif-item .grow span { font-size: var(--fs-cap); color: var(--text-secondary); }
.notif-ico {
  width: 30px; height: 30px; border-radius: var(--r-ctl);
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--text-secondary);
}
.notif-kosong {
  padding: var(--s5); text-align: center;
  color: var(--text-muted); font-size: var(--fs-sm);
  display: grid; gap: 8px; justify-items: center;
}

/* indikator koneksi WA */
.wa-status {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-cap); font-weight: 600;
  background: var(--gray-tint); color: var(--gray);
  text-decoration: none;
}
.wa-status:hover { text-decoration: none; filter: brightness(.97); }
.wa-status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex-shrink: 0; }
.wa-status.connected   { background: var(--ok-tint);   color: var(--ok); }
.wa-status.connected .led { background: var(--ok); }
.wa-status.reconnecting { background: var(--warn-tint); color: var(--warn); }
.wa-status.reconnecting .led { background: var(--warn); animation: pulse 1.4s infinite; }
.wa-status.disconnected { background: var(--bad-tint);  color: var(--bad); }
.wa-status.disconnected .led { background: var(--bad); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.8); }
}

/* chip admin */
.admin-chip {
  display: flex; align-items: center; gap: var(--s2);
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-pill);
  text-decoration: none; color: inherit;
  transition: background var(--t);
}
.admin-chip:hover { background: #F1F5F9; text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), var(--aqua));
  color: #fff; font-weight: 700; font-size: var(--fs-sm);
  display: grid; place-items: center; flex-shrink: 0;
}
.avatar.lg { width: 80px; height: 80px; font-size: 28px; }
.avatar.sm { width: 28px; height: 28px; font-size: var(--fs-cap); }
.admin-chip .hi { font-size: var(--fs-sm); font-weight: 600; line-height: 1.15; }
.admin-chip .sub { font-size: var(--fs-cap); color: var(--text-secondary); }

/* 5.3 Content & Footer */
.content { padding: var(--s6); flex: 1 1 auto; min-width: 0; }
.footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s5) var(--s6);
  font-size: var(--fs-cap); color: var(--text-muted);
  flex-wrap: wrap;
}

/* 5.4 Responsive shell */
.scrim {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 39; opacity: 0; pointer-events: none;
  transition: opacity var(--t);
}

@media (max-width: 1279px) {
  .t5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .t3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--sh-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .search-pill { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-pill span { display: none; }
  .content { padding: var(--s4); }
  .topbar { padding: 0 var(--s4); }
}
@media (max-width: 767px) {
  .t2, .t3, .t5 { grid-template-columns: minmax(0, 1fr); }
  .tb-crumb, .admin-chip .txt { display: none; }
  .footer { padding: var(--s4); }
}

/* --------------------------------------------------------------------------
   6. KARTU
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
}
.card-pad { padding: var(--s5); }
.card-pad-sm { padding: var(--s4); }
.card-hover { transition: transform var(--t), box-shadow var(--t); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); }

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: var(--fs-card); font-weight: 600; }
.card-body { padding: var(--s5); }
.card-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--border); background: #FCFDFE; border-radius: 0 0 var(--r-card) var(--r-card); }

/* 6.1 Hero Banner (Design.md §4.1) */
.hero {
  background: linear-gradient(135deg, var(--bg-hero-from) 0%, var(--bg-hero-to) 100%);
  border-radius: var(--r-lg);
  padding: var(--s6);
  display: flex; align-items: center; gap: var(--s6);
  overflow: hidden;
  position: relative;
}
.hero h1 { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hero-greeting-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s2);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.hero-greeting-pill svg { color: var(--primary-600); flex-shrink: 0; }
.hero h1 .nm { color: var(--primary-600); }
.hero p { color: var(--text-secondary); font-size: var(--fs-body); margin-top: 2px; }
.hero-art { flex-shrink: 0; margin-left: auto; opacity: .95; }
.hero-cta { margin-top: var(--s4); display: flex; gap: var(--s3); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   7. STAT / KPI CARD (Design.md §4.2)
   -------------------------------------------------------------------------- */
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: var(--s4);
  display: flex; align-items: center; gap: var(--s4);
  text-decoration: none; color: inherit;
  transition: transform var(--t), box-shadow var(--t);
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); text-decoration: none; }
.stat-ico {
  width: 44px; height: 44px; border-radius: var(--r-box);
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-label { font-size: var(--fs-label); color: var(--text-secondary); font-weight: 500; }
.stat-value { font-size: var(--fs-kpi); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-cap { font-size: var(--fs-cap); font-weight: 500; }

/* --------------------------------------------------------------------------
   8. BADGE / CHIP (Design.md §4.5)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-cap); font-weight: 600;
  white-space: nowrap;
  background: var(--gray-tint); color: var(--gray);
}
.badge svg { flex-shrink: 0; }
.badge.lg { height: 26px; padding: 0 11px; font-size: var(--fs-label); }
.badge.ok    { background: var(--ok-tint);     color: var(--ok); }
.badge.warn  { background: var(--warn-tint);   color: var(--warn); }
.badge.bad   { background: var(--bad-tint);    color: var(--bad); }
.badge.info  { background: var(--info-tint);   color: var(--info); }
.badge.purple{ background: var(--purple-tint); color: var(--purple); }
.badge.gold  { background: var(--gold-tint);   color: #B45309; }
.badge.gray  { background: var(--gray-tint);   color: var(--gray); }

/* badge level — warna level, BUKAN warna status */
.lv-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-cap); font-weight: 600;
  white-space: nowrap;
  background: var(--lv-tint, var(--gray-tint));
  color: var(--lv, var(--gray));
}
.lv-badge.lg { height: 26px; padding: 0 11px; font-size: var(--fs-label); }
.lv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lv, var(--gray)); flex-shrink: 0; }

/* chip kategori materi (Design.md §2.4) */
.kat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-cap); font-weight: 600;
  background: var(--k-tint, var(--gray-tint));
  color: var(--k, var(--gray));
  white-space: nowrap;
}
.kat-chip.ujian {
  background: var(--gold-tint); color: #B45309;
  border: 1px solid rgba(245, 158, 11, .45);
}

/* chip filter */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: #fff;
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--t);
}
.chip:hover { border-color: #C7D2E4; background: #FCFDFE; }
.chip.on {
  background: var(--lv, var(--primary-600)); border-color: transparent;
  color: #fff; font-weight: 600;
}
.chip .n { font-weight: 700; opacity: .75; }

/* Chip template custom (dengan tombol hapus) */
.chip-wrap { display: inline-flex; align-items: center; position: relative; }
.chip-wrap .chip { padding-right: 24px; }
.chip-x {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
}
.chip-x:hover { background: rgba(0, 0, 0, .08); color: var(--bad); }

/* Pratinjau pesan (bubble ala WhatsApp) */
.wa-preview {
  margin-top: 6px; padding: 12px 14px;
  border-radius: 12px 12px 12px 4px;
  background: #E7F7D8; color: #14301F;
  border: 1px solid #CDE9B8;
  font-size: var(--fs-sm); line-height: 1.55;
  word-break: break-word; max-height: 260px; overflow: auto;
}
.wa-preview .t-muted { color: #5B6B5B; }
mark.ph-bad {
  background: #FEE2E2; color: #B91C1C;
  border-radius: 4px; padding: 0 3px; font-weight: 600;
}

/* --------------------------------------------------------------------------
   Kirim WhatsApp — tata letak ramah (langkah 1-2-3)
   -------------------------------------------------------------------------- */
.wa-head { align-items: center; }
.page-ic {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--info-tint); color: var(--primary-700);
}

.wa-grid {
  display: grid; gap: var(--s5); align-items: start;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
}
.wa-side { position: sticky; top: 16px; }
@media (max-width: 900px) {
  .wa-grid { grid-template-columns: 1fr; }
  .wa-side { position: static; }
}

/* Langkah */
.step + .step {
  margin-top: var(--s6); padding-top: var(--s6);
  border-top: 1px dashed var(--border);
}
.step-head { display: flex; align-items: flex-start; gap: var(--s3); }
.step-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-600); color: #fff;
  font-size: 13px; font-weight: 700;
}
.step-kirim .step-num { background: var(--ok); }
.step-title { font-size: var(--fs-card); font-weight: 700; line-height: 1.25; }
.step-sub { font-size: var(--fs-label); color: var(--text-secondary); margin-top: 2px; }

/* Daftar penerima */
.list-penerima {
  max-height: 300px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 4px 10px; background: #FCFDFE;
}
.penerima-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: 9px 6px; border-radius: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--t);
}
.penerima-row:last-child { border-bottom: 0; }
.penerima-row:hover { background: #F4F7FC; }
.penerima-row.on { background: #EEF4FF; }
.penerima-row.off { opacity: .6; cursor: not-allowed; }
/* teks dalam baris penerima bisa menyusut & pindah baris agar tak meluap */
.penerima-row > :not(.penerima-cek) { min-width: 0; overflow-wrap: anywhere; }
.penerima-cek {
  width: 18px; height: 18px; flex-shrink: 0;
  accent-color: var(--primary-600);
}

/* Kotak "akan dikirim ke" */
.pilih-box {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-ctl);
  background: #F6F9FE; border: 1px dashed var(--border);
}
.pilih-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--primary-600); color: #fff; border: 0;
  font-size: var(--fs-cap); font-weight: 600; cursor: pointer;
  transition: background var(--t);
}
.pilih-chip:hover { background: var(--primary-700); }

/* Chip template & data */
.tpl-chip .chip-ic { display: inline-flex; opacity: .8; }
.data-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* Kartu status koneksi */
.wa-koneksi {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-radius: var(--r-ctl);
  border: 1px solid var(--border); background: #FCFDFE;
}
.wa-koneksi-ic {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
}
.wa-koneksi-t { font-size: var(--fs-sm); font-weight: 700; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.wa-koneksi-s { font-size: var(--fs-cap); color: var(--text-secondary); margin-top: 1px; min-width: 0; overflow-wrap: anywhere; }
.wa-koneksi.connected { background: var(--ok-tint); border-color: #BBF7D0; }
.wa-koneksi.connected .wa-koneksi-ic { background: #fff; color: var(--ok); }
.wa-koneksi.connected .wa-koneksi-t { color: #166534; }
.wa-koneksi.reconnecting { background: var(--warn-tint); border-color: #FDE68A; }
.wa-koneksi.reconnecting .wa-koneksi-ic { background: #fff; color: var(--warn); }
.wa-koneksi.reconnecting .wa-koneksi-t { color: #92400E; }
.wa-koneksi.disconnected { background: var(--bad-tint); border-color: #FECACA; }
.wa-koneksi.disconnected .wa-koneksi-ic { background: #fff; color: var(--bad); }
.wa-koneksi.disconnected .wa-koneksi-t { color: #991B1B; }

/* --------------------------------------------------------------------------
   9. TABEL (Design.md §4.4)
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: #fff;
}
.table-wrap.scroll-y { max-height: 520px; }
table.dt { font-size: var(--fs-sm); }
table.dt thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F8FAFC;
  font-size: var(--fs-label); font-weight: 600; color: var(--text-secondary);
  text-align: left; padding: 10px var(--s4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.dt tbody td {
  padding: 11px var(--s4);
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
table.dt tbody tr:last-child td { border-bottom: none; }
table.dt tbody tr { transition: background var(--t); }
table.dt tbody tr:hover { background: #F8FAFC; }
table.dt tbody tr.dim td { color: var(--text-muted); }
table.dt tbody tr.dim .nm-cell { opacity: .65; }
table.dt tbody tr.warn-row { background: rgba(254, 243, 199, .35); }
table.dt .nm-cell { font-weight: 600; color: inherit; text-decoration: none; }
table.dt .nm-cell:hover { color: var(--primary-600); text-decoration: underline; }
table.dt th.ta-r, table.dt td.ta-r { text-align: right; }
table.dt th.ta-c, table.dt td.ta-c { text-align: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* daftar kartu untuk < 768px */
.card-list { display: none; }
@media (max-width: 767px) {
  .table-wrap.table-cards { display: none; }
  .card-list { display: grid; gap: var(--s3); }
  .list-card {
    border: 1px solid var(--border); border-radius: var(--r-box);
    padding: var(--s4); background: #fff;
  }
  .list-card.dim { opacity: .65; }

  /* Tab membungkus di HP supaya label terakhir tidak terpotong. */
  .tabs {
    flex-wrap: wrap;
    gap: var(--s2) var(--s5);
    overflow-x: visible;
  }
  .tab { padding: 9px 2px 10px; }
}

/* --------------------------------------------------------------------------
   10. PROGRESS (Design.md §4.6)
   -------------------------------------------------------------------------- */
.prog {
  height: 9px; border-radius: var(--r-pill);
  background: #EDF1F7; overflow: hidden;
}
.prog > i {
  display: block; height: 100%; border-radius: var(--r-pill);
  background: var(--lv, var(--primary-600));
  transition: width 700ms cubic-bezier(.16, 1, .3, 1);
}
.prog.thin { height: 6px; }
.prog-label { display: flex; justify-content: space-between; font-size: var(--fs-cap); color: var(--text-secondary); margin-bottom: 5px; }

/* sisa paket: ●●○○ */
.pips { display: inline-flex; gap: 4px; align-items: center; }
.pips i { width: 10px; height: 10px; border-radius: 3px; background: #E5EAF2; display: block; }
.pips i.on { background: var(--c, var(--ok)); }

/* --------------------------------------------------------------------------
   11. ALERT (Design.md §4.7)
   -------------------------------------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-ctl);
  font-size: var(--fs-sm);
  border-left: 3px solid transparent;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert b { font-weight: 600; }
.alert.info  { background: var(--info-tint);   border-left-color: var(--info);   color: #1E40AF; }
.alert.warn  { background: var(--warn-tint);   border-left-color: var(--warn);   color: #92400E; }
.alert.error { background: var(--bad-tint);    border-left-color: var(--bad);    color: #991B1B; }
.alert.ok    { background: var(--ok-tint);     border-left-color: var(--ok);     color: #14532D; }
.alert.ghost { background: var(--gray-tint);   border-left-color: var(--gray);   color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   12. TOMBOL (Design.md §4.8)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 var(--s4);
  border-radius: var(--r-ctl);
  font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), opacity var(--t);
}
.btn:hover { text-decoration: none; }
.btn.primary   { background: var(--primary-600); color: #fff; }
.btn.primary:hover { background: var(--primary-700); }
.btn.secondary { background: #fff; border-color: #D9E0EC; color: var(--text-primary); }
.btn.secondary:hover { background: #F8FAFC; border-color: #C7D2E4; }
.btn.ghost     { background: transparent; color: var(--primary-600); }
.btn.ghost:hover { background: #EFF5FF; }
.btn.danger-solid { background: var(--bad); color: #fff; }
.btn.danger-solid:hover { background: #B91C1C; }
/* "Nonaktifkan" — secondary dengan teks merah, bukan solid */
.btn.danger { background: #fff; border-color: #F3C6C6; color: var(--bad); }
.btn.danger:hover { background: var(--bad-tint); }
.btn.sm { height: 32px; padding: 0 12px; font-size: var(--fs-cap); border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 var(--s5); font-size: var(--fs-body); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn.loading { pointer-events: none; opacity: .75; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-primary); }
.field .hint { font-size: var(--fs-cap); color: var(--text-muted); }
.field .err { font-size: var(--fs-cap); color: var(--bad); font-weight: 500; }
.field .norm {
  font-size: var(--fs-cap); color: var(--primary-600);
  font-weight: 600; font-variant-numeric: tabular-nums;
}

.input, .select, .textarea {
  height: 42px; padding: 0 var(--s3);
  border: 1px solid #D9E0EC; border-radius: var(--r-ctl);
  background: #fff; font-size: var(--fs-sm);
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
}
.textarea { height: auto; min-height: 96px; padding: 10px var(--s3); resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary-600);
  box-shadow: 0 0 0 3px var(--ring);
}
.input:disabled, .select:disabled, .textarea:disabled { background: #F8FAFC; color: var(--text-muted); }
.input.invalid, .select.invalid { border-color: var(--bad); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input-icon { position: relative; }
.input-icon .input { padding-left: 40px; }
.input-icon > svg,
.input-icon > span:first-child:not(.eye) {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
  display: flex; align-items: center; line-height: 0;
}
.input-icon .eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-muted);
}
.input-icon .eye:hover { background: #F1F5F9; }

.input-unit { position: relative; }
.input-unit .unit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: var(--fs-cap); color: var(--text-secondary); pointer-events: none;
}
.input-unit .input { padding-right: 52px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: var(--r-pill);
  background: #CBD5E1; position: relative; flex-shrink: 0;
  transition: background var(--t);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-card);
  transition: transform var(--t);
}
.switch input:checked + .track { background: var(--primary-600); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + .track { opacity: .5; }
.switch .sw-label { font-size: var(--fs-sm); font-weight: 500; }

/* baris setelan: label kiri, kontrol kanan (Design.md §5.17) */
.set-row {
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-row .set-info { flex: 1 1 auto; min-width: 0; }
.set-row .set-info .n { font-size: var(--fs-sm); font-weight: 600; }
.set-row .set-info .d { font-size: var(--fs-cap); color: var(--text-secondary); margin-top: 2px; }
.set-row .set-ctl { flex-shrink: 0; display: flex; align-items: center; gap: var(--s2); }
.set-row .set-ctl .input, .set-row .set-ctl .select { width: auto; min-width: 130px; }
.set-row.dirty .set-info .n::after {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn); margin-left: 6px; vertical-align: middle;
}

/* form footer lengket */
.form-foot {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s3);
  padding: var(--s4) 0;
  margin-top: var(--s4);
  background: linear-gradient(180deg, rgba(243, 246, 251, 0), var(--bg-app) 32%);
}

/* --------------------------------------------------------------------------
   14. TABS (Design.md §5.8, §5.12, §5.17)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex; gap: var(--s5);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 11px 2px 13px;
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
  text-decoration: none;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.on { color: var(--primary-600); font-weight: 600; border-bottom-color: var(--tab-c, var(--primary-600)); }
.tab .cnt {
  margin-left: 6px; padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--gray-tint); color: var(--text-secondary);
  font-size: var(--fs-cap); font-weight: 700;
}
.tab.on .cnt { background: var(--tab-c, var(--primary-600)); color: #fff; }

/* --------------------------------------------------------------------------
   15. MODAL (Design.md §4.11)
   -------------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: var(--s4);
}
.modal.open { display: flex; }
.modal-scrim { position: absolute; inset: 0; background: var(--overlay); animation: fade var(--t); }
.modal-box {
  position: relative;
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  display: flex; flex-direction: column;
  animation: pop 200ms cubic-bezier(.16, 1, .3, 1);
}
.modal-box.md { max-width: 680px; }
.modal-box.lg { max-width: 900px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s3);
}
.modal-head h3 { font-size: 17px; font-weight: 600; }
.modal-head p { font-size: var(--fs-cap); color: var(--text-secondary); margin-top: 2px; }
.modal-x {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-secondary); flex-shrink: 0;
}
.modal-x:hover { background: #F1F5F9; }
.modal-body { padding: 0 var(--s5) var(--s5); overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--border);
  background: #FCFDFE; border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.modal-foot .left { margin-right: auto; }

/* drawer sisi */
.drawer {
  position: fixed; inset: 0; z-index: 60; display: none;
}
.drawer.open { display: block; }
.drawer-box {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: #fff; box-shadow: var(--sh-pop);
  display: flex; flex-direction: column;
  animation: slide 220ms cubic-bezier(.16, 1, .3, 1);
}
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }

/* --------------------------------------------------------------------------
   16. TOAST (Design.md §4.11)
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed; top: var(--s4); right: var(--s4); z-index: 80;
  display: flex; flex-direction: column; gap: var(--s2);
  width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: 11px var(--s4);
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--r-box);
  box-shadow: var(--sh-pop);
  font-size: var(--fs-sm);
  animation: slidein 220ms cubic-bezier(.16, 1, .3, 1);
}
.toast.ok    { border-left-color: var(--ok); }
.toast.warn  { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }
.toast .x { margin-left: auto; color: var(--text-muted); }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } }
@media (max-width: 767px) {
  .toasts { top: auto; bottom: 88px; right: var(--s3); left: var(--s3); width: auto; }
}

/* --------------------------------------------------------------------------
   17. DONUT / CHART (Design.md §4.9)
   -------------------------------------------------------------------------- */
.donut { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.donut-svg { transform: rotate(-90deg); flex-shrink: 0; }
.donut-track { fill: none; stroke: #EDF1F7; }
.donut-mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-wrap { position: relative; flex-shrink: 0; }
.donut-big { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-lbl { font-size: var(--fs-cap); color: var(--text-secondary); margin-top: 3px; }
.legend { display: grid; gap: 7px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); }
.legend-item i { width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--gray)); flex-shrink: 0; }
.legend-item .v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   18. SEGMENTED CONTROL (Design.md §5.10)
   -------------------------------------------------------------------------- */
.seg {
  display: inline-flex; gap: 3px; padding: 3px;
  background: #F1F5F9; border-radius: var(--r-ctl);
}
.seg button {
  height: 32px; padding: 0 12px;
  border-radius: 8px;
  font-size: var(--fs-cap); font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--t), color var(--t);
  min-width: 44px;
}
.seg button:hover { color: var(--text-primary); }
.seg button[aria-checked="true"] { background: #fff; box-shadow: var(--sh-card); color: var(--c, var(--primary-600)); }
.seg button[aria-checked="true"].hadir  { color: var(--ok); }
.seg button[aria-checked="true"].izin   { color: var(--info); }
.seg button[aria-checked="true"].sakit  { color: var(--warn); }
.seg button[aria-checked="true"].alfa   { color: var(--bad); }
@media (max-width: 767px) {
  .seg button { height: 44px; padding: 0 14px; }
}

/* --------------------------------------------------------------------------
   19. STATE: EMPTY / SKELETON / ERROR (Design.md §4.12)
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: var(--s7) var(--s5); }
.empty-ico {
  width: 56px; height: 56px; border-radius: var(--r-box);
  background: var(--bg-hero-from); color: var(--primary-500);
  display: grid; place-items: center; margin: 0 auto var(--s3);
}
.empty h4 { font-size: var(--fs-card); font-weight: 600; }
.empty p { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 4px; max-width: 380px; }
.empty .btn { margin-top: var(--s4); }

.skel {
  background: linear-gradient(90deg, #E8EEF7 25%, #F2F6FC 37%, #E8EEF7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-line { height: 12px; margin-bottom: 9px; }
.skel-card { height: 78px; }

.err-card {
  background: var(--bad-tint); color: #991B1B;
  border: 1px solid #F5C2C2; border-radius: var(--r-card);
  padding: var(--s5); text-align: center;
}
.err-card p { font-size: var(--fs-sm); margin-top: 4px; }
.err-card .btn { margin-top: var(--s4); }

/* --------------------------------------------------------------------------
   20. MINI CALENDAR (Design.md §4.13)
   -------------------------------------------------------------------------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 600; color: var(--text-muted); padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 8px;
  display: grid; place-items: center;
  font-size: var(--fs-cap); font-variant-numeric: tabular-nums;
  color: var(--text-primary); position: relative;
  background: transparent;
}
.cal-cell.out { color: #CBD5E1; }
.cal-cell.sun { color: var(--bad); }
.cal-cell.today { background: var(--primary-600); color: #fff; font-weight: 700; }
.cal-cell.has::after {
  content: ""; position: absolute; bottom: 4px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--aqua);
}
.cal-cell.today.has::after { background: #fff; }

/* --------------------------------------------------------------------------
   21. QUICK ACCESS (Design.md §4.14)
   -------------------------------------------------------------------------- */
.qa {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-box);
  background: #fff; text-decoration: none; color: inherit;
  transition: transform var(--t), box-shadow var(--t);
}
.qa:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); text-decoration: none; }
.qa-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--q, var(--bg-hero-from)); color: var(--qc, var(--primary-600)); }
.qa .n { font-size: var(--fs-sm); font-weight: 600; }

/* --------------------------------------------------------------------------
   22. LENCANA / GAMIFIKASI (Design.md §5.5, §5.7)
   -------------------------------------------------------------------------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s3); }
.lencana {
  text-align: center; padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-box);
  background: #fff;
}
.lencana .em { font-size: 26px; line-height: 1; }
.lencana .nm { font-size: var(--fs-cap); font-weight: 600; margin-top: 5px; }
.lencana.locked { background: #FAFBFC; border-style: dashed; }
.lencana.locked .em { filter: grayscale(1); opacity: .4; }
.lencana.locked .nm { color: var(--text-muted); }

/* Medali lencana — emoji di dalam cincin beranimasi */
.lnc {
  position: relative; display: inline-grid; place-items: center;
  width: var(--sz); height: var(--sz); border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, var(--tint), #ffffff 78%);
  box-shadow: inset 0 0 0 2px var(--tint);
}
.lnc-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--c); opacity: .55;
  animation: lncRing 2.8s ease-in-out infinite;
}
.lnc-em { font-size: calc(var(--sz) * .52); line-height: 1; display: block; will-change: transform; }
.lnc.locked { background: #F8FAFC; box-shadow: inset 0 0 0 2px #E5E9F0; }
.lnc.locked .lnc-ring { border-style: dashed; border-color: #CBD5E1; opacity: .9; animation: none; }
.lnc.locked .lnc-em { filter: grayscale(1); opacity: .4; }

@keyframes lncRing { 0%,100% { transform: scale(1); opacity: .5 } 50% { transform: scale(1.06); opacity: .85 } }
@keyframes lncBounce { 0%,100% { transform: translateY(0) } 25% { transform: translateY(-16%) } 45% { transform: translateY(0) } 65% { transform: translateY(-7%) } 80% { transform: translateY(0) } }
@keyframes lncFloat { 0%,100% { transform: translateY(-5%) } 50% { transform: translateY(7%) } }
@keyframes lncWiggle { 0%,100% { transform: rotate(-9deg) } 50% { transform: rotate(9deg) } }
@keyframes lncPulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.18) } }
@keyframes lncShake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-9%) } 75% { transform: translateX(9%) } }
@keyframes lncBob { 0%,100% { transform: translateY(0) rotate(-7deg) } 50% { transform: translateY(-12%) rotate(7deg) } }
@keyframes lncSway { 0%,100% { transform: rotate(-13deg) } 50% { transform: rotate(13deg) } }
@keyframes lncSwing { 0%,100% { transform: rotate(-16deg) } 50% { transform: rotate(16deg) } }
@keyframes lncGlow { 0%,100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent) } 50% { transform: scale(1.14); filter: drop-shadow(0 0 7px var(--c)) } }
@keyframes lncPop { 0%,100% { transform: scale(1) } 40% { transform: scale(1.22) } 70% { transform: scale(.96) } }

.lnc-em.lnc-bounce { animation: lncBounce 1.8s ease-in-out infinite; }
.lnc-em.lnc-float { animation: lncFloat 2.6s ease-in-out infinite; }
.lnc-em.lnc-wiggle { animation: lncWiggle 1.3s ease-in-out infinite; }
.lnc-em.lnc-pulse { animation: lncPulse 2s ease-in-out infinite; }
.lnc-em.lnc-shake { animation: lncShake 2.2s ease-in-out infinite; }
.lnc-em.lnc-bob { animation: lncBob 2.4s ease-in-out infinite; }
.lnc-em.lnc-sway { animation: lncSway 2.6s ease-in-out infinite; }
.lnc-em.lnc-swing { animation: lncSwing 2.2s ease-in-out infinite; }
.lnc-em.lnc-glow { animation: lncGlow 2.2s ease-in-out infinite; }
.lnc-em.lnc-pop { animation: lncPop 2.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .lnc-ring, .lnc-em { animation: none !important; }
}

.streak-flame {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700; font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   23. JADWAL MINGGUAN (Design.md §5.8)
   -------------------------------------------------------------------------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s3); align-items: start; }
.day-col { display: flex; flex-direction: column; gap: var(--s2); }
.day-head {
  padding: 9px var(--s3); border-radius: var(--r-ctl);
  background: #F8FAFC; text-align: center;
  font-size: var(--fs-cap); font-weight: 600; color: var(--text-secondary);
}
.day-head.today { background: var(--primary-600); color: #fff; }
.day-head .d { font-size: var(--fs-sm); font-weight: 700; display: block; }
.sesi {
  text-align: left; width: 100%;
  padding: 9px 10px; border-radius: 10px;
  background: var(--lv-tint, var(--info-tint));
  border-left: 3px solid var(--lv, var(--primary-500));
  font-size: var(--fs-cap);
  transition: transform var(--t), box-shadow var(--t);
}
.sesi:hover { transform: translateY(-1px); box-shadow: var(--sh-hover); }
.sesi .tm { font-weight: 700; color: var(--lv, var(--primary-600)); font-variant-numeric: tabular-nums; }
.sesi .cl { font-weight: 600; margin-top: 2px; color: var(--text-primary); }
.sesi .lc { color: var(--text-secondary); margin-top: 1px; }
.sesi.no-pelatih { background: var(--warn-tint); border-left-color: var(--warn); }
.sesi.no-pelatih .tm { color: var(--warn); }
@media (max-width: 1023px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .week { grid-template-columns: minmax(0, 1fr); } }

/* editor jam siap */
.jam-grid { display: grid; gap: var(--s2); }
.jam-row {
  display: flex; align-items: center; gap: var(--s2);
  padding: 9px var(--s3); border-radius: var(--r-ctl);
  background: var(--info-tint); border: 1px solid #C7DBFB;
}
.jam-row .input { width: auto; flex: 1 1 0; min-width: 0; }
.jam-row .sw-day { width: 110px; }

/* --------------------------------------------------------------------------
   24. TIMELINE (Design.md §5.5 — Riwayat Level)
   -------------------------------------------------------------------------- */
.tl { position: relative; padding-left: var(--s5); }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: var(--s4); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: calc(-1 * var(--s5) + 2px); top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--lv, var(--primary-600)); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--lv-tint, var(--info-tint));
}
.tl-item .t { font-size: var(--fs-sm); font-weight: 600; }
.tl-item .d { font-size: var(--fs-cap); color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   25. ASISTEN — WIDGET & CHAT (Design.md §3.4, §5.15)
   -------------------------------------------------------------------------- */
.ai-fab {
  position: fixed; right: var(--s5); bottom: var(--s5); z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-600); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .35);
  transition: transform var(--t), background var(--t);
}
.ai-fab:hover { transform: scale(1.05); background: var(--primary-700); }
.ai-fab .ping {
  position: absolute; top: 2px; right: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold); border: 2px solid #fff;
}

.ai-panel {
  position: fixed; right: var(--s5); bottom: calc(var(--s5) + 68px); z-index: 55;
  width: 360px; height: 520px; max-height: calc(100vh - 140px);
  background: #fff; border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(16, 24, 40, .18);
  border: 1px solid var(--border);
  display: none; flex-direction: column; overflow: hidden;
}
.ai-panel.open { display: flex; }
.ai-head { background: var(--primary-600); color: #fff; padding: var(--s3) var(--s4); display: flex; align-items: center; gap: var(--s3); }
.ai-head .n { font-size: var(--fs-sm); font-weight: 600; }
.ai-head .s { font-size: var(--fs-cap); opacity: .85; display: flex; align-items: center; gap: 5px; }
.ai-body { flex: 1 1 auto; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); background: #F8FAFC; }
.ai-foot { padding: var(--s3); border-top: 1px solid var(--border); display: flex; gap: var(--s2); align-items: flex-end; }
.ai-foot .textarea { min-height: 40px; max-height: 96px; height: 40px; }
.ai-msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ai-msg.me { align-self: flex-end; background: var(--primary-600); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg .who { font-size: 10px; font-weight: 700; opacity: .6; display: block; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .05em; }
.ai-tool {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: #EDE9FE; color: var(--purple);
  font-size: 10.5px; font-weight: 600;
}
.ai-typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 14px; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: bounce 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

.suggest {
  padding: 9px 12px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-primary); text-align: left;
  transition: border-color var(--t), background var(--t);
}
.suggest:hover { border-color: var(--primary-500); background: #F8FBFF; }

@media (max-width: 767px) {
  .ai-panel {
    right: 0; left: 0; bottom: 0; width: auto; height: 100%;
    max-height: 100%; border-radius: 0; border: none;
  }
}

/* --------------------------------------------------------------------------
   26. QR PANEL (Design.md §5.17)
   -------------------------------------------------------------------------- */
.qr-panel { text-align: center; padding: var(--s5); }
.qr-box {
  width: 240px; height: 240px; margin: 0 auto var(--s4);
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-box);
  display: grid; place-items: center; overflow: hidden; padding: 10px;
}
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.qr-steps { text-align: left; display: grid; gap: var(--s2); margin-top: var(--s4); font-size: var(--fs-sm); color: var(--text-secondary); }
.qr-steps li { display: flex; gap: var(--s2); }
.qr-steps .n {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--info-tint); color: var(--primary-600);
  font-size: var(--fs-cap); font-weight: 700; display: grid; place-items: center;
}

/* --------------------------------------------------------------------------
   27. HALAMAN PUBLIK (index / login / rapor) — Design.md §5.1, §5.2, §5.16
   -------------------------------------------------------------------------- */
.pnav {
  height: 68px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s6);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), var(--aqua));
  color: #fff; display: grid; place-items: center; flex-shrink: 0;
  overflow: hidden;
}
.brand-mark img, .sb-logo img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; display: block;
}
.brand .n { font-size: 16px; font-weight: 700; line-height: 1.1; }
.brand .s { font-size: 10.5px; color: var(--text-secondary); }

.phero {
  background: linear-gradient(135deg, #2563EB 0%, #3B82F6 45%, #06B6D4 100%);
  color: #fff; padding: var(--s7) var(--s6); position: relative; overflow: hidden;
}
.phero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.phero p { font-size: 17px; opacity: .92; margin-top: var(--s3); max-width: 560px; color: rgba(255, 255, 255, .94); }
.pwrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); }
.sec { padding: var(--s7) 0; }
.sec-h { text-align: center; margin-bottom: var(--s6); }
.sec-h h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.sec-h p { color: var(--text-secondary); margin-top: 5px; }

.feat { text-align: left; }
.feat .ico {
  width: 46px; height: 46px; border-radius: var(--r-box);
  display: grid; place-items: center; margin-bottom: var(--s3);
  background: var(--f, var(--bg-hero-from)); color: var(--fc, var(--primary-600));
}
.feat h4 { font-size: var(--fs-card); font-weight: 600; }
.feat p { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 5px; }

.lv-card { text-align: center; border-top: 3px solid var(--lv); }
.lv-card .n { font-size: 11px; font-weight: 700; color: var(--lv); text-transform: uppercase; letter-spacing: .06em; }
.lv-card .f { font-size: var(--fs-card); font-weight: 600; margin-top: 5px; }
.lv-card .m { font-size: var(--fs-cap); color: var(--text-secondary); margin-top: 5px; }

/* Detail list (modal) — baris label/nilai */
.dl { display: flex; flex-direction: column; gap: 10px; }
.dl-row { display: flex; gap: 14px; align-items: baseline; }
.dl-row .t-label:first-child { min-width: 132px; flex: 0 0 auto; }

/* Form pendaftaran leads (landing page) */
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reg-grid .field { margin: 0; }
.reg-grid .textarea { grid-column: 1 / -1; }
.reg-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.req { color: var(--bad); }
.lead-msg { font-size: var(--fs-sm); font-weight: 500; }
.lead-msg.err { color: var(--bad); }
.lead-msg.ok { color: var(--ok); }
.lead-sukses { text-align: center; padding: var(--s5) var(--s3); }
.lead-sukses svg { color: var(--ok); margin-bottom: 8px; }
.lead-sukses h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.lead-sukses p { color: var(--text-secondary); font-size: var(--fs-sm); }
/* Ikon HANYA berputar saat tombol dalam status memuat (.loading) — BUKAN setiap tombol disabled.
   Sebelumnya `.btn:disabled svg` membuat ikon/logo tombol yang nonaktif berputar tanpa henti. */
.btn.loading svg { animation: spin 1s linear infinite; }
@media (max-width: 560px) { .reg-grid { grid-template-columns: 1fr; } }

/* login split */
.split { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.split-l {
  background: linear-gradient(160deg, #1E5FD8 0%, #3B82F6 70%, #06B6D4 130%);
  color: #fff; padding: var(--s7) var(--s6);
  display: flex; flex-direction: column; justify-content: center; gap: var(--s5);
  position: relative; overflow: hidden;
}
.split-r { display: grid; place-items: center; padding: var(--s6) var(--s5); background: #fff; }
.login-card { width: 100%; max-width: 420px; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split-l { padding: var(--s6) var(--s5); gap: var(--s4); }
  .split-l .art { display: none; }
}

/* rapor orang tua */
.rapor { max-width: 720px; margin: 0 auto; padding: var(--s5); }
.rapor-head {
  background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
  border: 1px solid #FED7AA; border-radius: var(--r-lg);
  padding: var(--s6); text-align: center;
}
.rapor-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.rapor-head .nm { color: #C2410C; }
/* pembayaran: ringkasan 4 kartu */
.pembayaran-ringkas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .pembayaran-ringkas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.rapor-aksi {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.rapor-aksi .btn { white-space: nowrap; }
.rapor-aksi .btn svg { flex-shrink: 0; }
@media (max-width: 520px) {
  .rapor-aksi { gap: 6px; }
  .rapor-aksi .btn { flex: 1 1 auto; justify-content: center; }
}

/* --------------------------------------------------------------------------
   28. UTILITAS KECIL
   -------------------------------------------------------------------------- */
.divider { height: 1px; background: var(--border); border: none; }
.vsep { width: 1px; align-self: stretch; background: var(--border); }
.dot-sep::before { content: "·"; color: var(--text-muted); margin: 0 5px; }
.mt1{margin-top:var(--s1)} .mt2{margin-top:var(--s2)} .mt3{margin-top:var(--s3)}
.mt4{margin-top:var(--s4)} .mt5{margin-top:var(--s5)} .mt6{margin-top:var(--s6)}
.w-full{width:100%} .maxw-720{max-width:720px} .maxw-420{max-width:420px}
.nowrap{white-space:nowrap}

/* --------------------------------------------------------------------------
   29. RESPONSIF — semua halaman harus rapi di HP
   --------------------------------------------------------------------------
   Dulu setiap halaman menangani layout mobile-nya sendiri dan sebagian
   besar tabel meluber keluar layar. Di sini kita tetapkan aturan umum:
     - grid otomatis turun ke 1 kolom
     - tabel boleh geser mendatar (bukan memotong isi)
     - hero, footer, topbar, dan form turun jadi bertumpuk
   -------------------------------------------------------------------------- */

/* Tabel: ubah jadi daftar kartu di layar sempit. */
@media (max-width: 767px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table.dt { min-width: 520px; }

  /* Kolom yang tidak wajib (aksi, tanggal panjang) disembunyikan */
  .table-wrap table.dt td.ta-hide-sm,
  .table-wrap table.dt th.ta-hide-sm { display: none; }

  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
}

/* Grid halaman */
@media (max-width: 1023px) {
  .g2p, .g3p, .g4p, .g5p { grid-template-columns: minmax(0, 1fr) !important; }
  .split-l { display: none; }
}

@media (max-width: 767px) {
  /* Hero: ilustrasi disembunyikan supaya teks tidak terpotong */
  .hero { flex-direction: column; align-items: flex-start; gap: var(--s4); padding: var(--s5); }
  .hero-art { display: none; }
  .hero h1 { font-size: 22px; }
  .hero-cta { width: 100%; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; }

  .card-head, .card-body, .card-pad, .card-pad-sm { padding-left: var(--s4); padding-right: var(--s4); }
  .card-head { flex-wrap: wrap; gap: var(--s2); }
  .card-head .btn { width: 100%; justify-content: center; }

  .content { padding: var(--s3); }

  /* Topbar: lonceng & WA tetap tampil, sisanya dirampingkan */
  .topbar { padding: 0 var(--s3); gap: var(--s2); }
  .tb-title { font-size: 15px; }
  .search-pill kbd { display: none; }

  /* Filter/search di dalam kartu */
  .input-icon, .input, .select, .textarea { font-size: 16px; } /* cegah zoom iOS */
  .g2p[style], .g3p[style] { grid-template-columns: minmax(0, 1fr) !important; }

  /* Baris sticky di footer form */
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot .btn { width: 100%; justify-content: center; }
  .form-foot .btn.left { width: auto; }

  .seg { width: 100%; }
  .seg button { flex: 1 1 0; padding: 0 6px; }

  .modal-box { width: calc(100vw - 24px); max-height: calc(100vh - 40px); }

  .notif-panel { right: 12px; left: 12px; width: auto; top: 58px; }

  .footer { flex-direction: column; align-items: flex-start; gap: 4px; }

  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }

  /* Kolom fleksibel (baris absensi / murid) jadi bertumpuk */
  .row-wrap > .field { flex: 1 1 100% !important; min-width: 0 !important; }
}

@media (max-width: 420px) {
  .stat { padding: var(--s3); gap: var(--s3); }
  .stat-value { font-size: 22px; }
  .seg button { height: 40px; font-size: 12px; }
}

@media print {
  .sidebar, .topbar, .footer, .ai-fab, .ai-panel, .no-print { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ==========================================================================
   Pemilih multi-tanggal (Tanggal libur — Settings)
   ========================================================================== */
.datelist { display: block; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-date {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--purple-tint); color: var(--purple);
  font-size: 13px; border: 1px solid #C7D2FE;
}
.chip-date svg { flex-shrink: 0; }
/* Tombol di dalam chip tanggal (Ubah & Hapus). Reset posisi absolut bawaan
   dari .chip-x global (yang dipakai chip template WA) agar tidak saling menumpuk. */
.chip-date .chip-x {
  position: static; top: auto; right: auto; transform: none;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px; border: none; background: transparent;
  color: var(--purple); cursor: pointer; padding: 0;
  border-radius: 50%; line-height: 1;
}
.chip-date .chip-x:hover { color: var(--bad); }

/* ==========================================================================
   POLES UI/UX MENYELURUH — micro-interaksi & konsistensi (15 Okt)
   Hanya penyempurnaan halus, tanpa mengubah struktur/layout.
   ========================================================================== */

/* Seleksi teks sesuai brand */
::selection { background: var(--primary-600); color: #fff; }

/* Scrollbar konsisten (Chrome/Edge) */
* { scrollbar-width: thin; scrollbar-color: #C7D2E4 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #C7D2E4; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #9FB3CC; }
*::-webkit-scrollbar-track { background: transparent; }

/* Scroll halus — hormati prefers-reduced-motion */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Tombol: transisi halus + state tekan + bayangan primary */
.btn {
  transition: background var(--t), border-color var(--t), box-shadow var(--t),
    opacity var(--t), color var(--t), transform .08s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 2px rgba(37, 99, 235, .26), 0 4px 12px rgba(37, 99, 235, .14); }
.btn.primary:hover { box-shadow: 0 2px 4px rgba(37, 99, 235, .30), 0 6px 16px rgba(37, 99, 235, .20); }
.btn.secondary:active { background: #EEF2F8; }
.btn.ghost:active { background: #E3EDFE; }

/* Input: hover sebelum fokus */
.input:hover:not(:focus):not(:disabled),
.select:hover:not(:focus):not(:disabled),
.textarea:hover:not(:focus):not(:disabled) { border-color: #C7D2E4; }

/* Chip: interaksi halus */
.chip { transition: background var(--t), border-color var(--t), color var(--t), transform .08s ease; }
.chip:active { transform: scale(.97); }

/* Kartu daftar (mobile): hover elevasi */
.list-card { transition: transform var(--t), box-shadow var(--t); }
.list-card:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); }

/* Hover baris tabel sedikit lebih jelas */
table.dt tbody tr:hover { background: #F0F6FF; }

/* =========================================================================
   ANIMASI LANDING PAGE — SwimTracker
   ========================================================================= */

/* Fade in naik (hero & section) */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Fade in dari kiri */
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Fade in dari kanan */
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Skala kecil ke besar (badge / ikon) */
@keyframes scaleUp {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Gelombang melayang */
@keyframes floatWave {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

/* Kedip halus (dot indikator) */
@keyframes pulseSoft {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.05); }
}

/* Kelas util animasi */
.animate { animation-fill-mode: both; animation-duration: .8s; animation-timing-function: cubic-bezier(.22,1,.36,1); }
.animate.fade-up    { animation-name: fadeUp; }
.animate.fade-left  { animation-name: fadeInLeft; }
.animate.fade-right { animation-name: fadeInRight; }
.animate.scale-up   { animation-name: scaleUp; }

/* Stagger delay untuk daftar kartu */
.animate.delay-1 { animation-delay: .1s; }
.animate.delay-2 { animation-delay: .2s; }
.animate.delay-3 { animation-delay: .3s; }
.animate.delay-4 { animation-delay: .4s; }
.animate.delay-5 { animation-delay: .5s; }
.animate.delay-6 { animation-delay: .6s; }

/* Float untuk ilustrasi gelombang */
.float-anim { animation: floatWave 6s ease-in-out infinite; }

/* Pulse untuk indikator WhatsApp */
.pulse-anim { animation: pulseSoft 2.5s ease-in-out infinite; }

/* Hover lift card */
.card-lift { transition: transform .3s ease, box-shadow .3s ease; }
.card-lift:hover { transform: translateY(-6px); box-shadow: var(--sh-hover); }

/* Tombol dengan ripple sederhana */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 0; height: 0; background: rgba(255,255,255,.35);
  border-radius: 50%; transform: translate(-50%,-50%);
  transition: width .3s ease, height .3s ease, opacity .3s ease;
  opacity: 0;
}
.btn:active::after {
  width: 200%; height: 200%; opacity: 1;
  transition: 0s;
}

/* Scroll reveal: elemen sembunyi dulu, muncul saat scroll */
.reveal { opacity: 0; transform: translateY(30px); transition: all .8s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Responsif animasi */
@media (max-width: 640px) {
  .reveal { transform: translateY(20px); }
}

/* Tombol WhatsApp floating */
.float-wa {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #25D366;
  color: #fff;
  border-radius: 50px;
  padding: 14px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(37, 211, 102, .25);
  z-index: 1000;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease;
}
.float-wa:hover {
  background: #1ebd55;
  transform: translateY(-3px) scale(1.03);
}
.float-wa:active { transform: translateY(-1px) scale(1); }
@media (max-width: 640px) {
  .float-wa { bottom: 16px; right: 16px; padding: 12px 16px; font-size: 13px; }
}

/* ==========================================================================
   Landing: galeri foto + popup promo
   ========================================================================== */
.galeri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.galeri-item {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #F1F5F9;
  box-shadow: 0 6px 18px rgba(2, 32, 71, .06);
}
.galeri-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.galeri-item:hover img { transform: scale(1.04); }

.popup-promo {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .55);
  animation: popup-fade .2s ease;
}
.popup-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 28px 24px 26px;
  border-radius: 18px;
  animation: popup-pop .25s ease;
}
.popup-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #F1F5F9;
  color: #475569;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.popup-x:hover { background: #E2E8F0; color: var(--bad); }
.popup-img { width: 100%; border-radius: 12px; display: block; }
.popup-teks { font-size: 15px; line-height: 1.6; color: var(--text); }
@keyframes popup-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes popup-pop {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .popup-promo, .popup-box { animation: none; }
}

/* ==========================================================================
   Pengaturan: kontrold upload gambar & galeri
   ========================================================================== */
.img-prev {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  place-items: center;
  min-height: 120px;
  background: #F8FAFC;
}
.img-prev img { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; }
.img-none {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 0;
  color: #94A3B8;
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #F8FAFC;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.img-thumb-x:hover { background: var(--bad); }

/* ==========================================================================
   30. PERBAIKAN MOBILE (viewport sempit / address bar browser HP)
   ========================================================================== */

/* 30.1 Sidebar: gunakan 100dvh (tinggi dinamis) agar address bar HP yang
   muncul/hilang tidak menutup bagian bawah sidebar. Tambahkan overflow-y auto
   sebagai jaring pengaman di layar sangat pendek, dan safe-area untuk
   perangkat ber-panel gestur (iPhone home indicator). */
.sidebar {
  height: 100vh;
  height: 100dvh; /* modern browsers: menyesuaikan address bar */
  overflow-y: auto;
  overscroll-behavior: contain;
}
@supports (height: 100dvh) {
  .sidebar { height: 100dvh; }
}
.sb-foot {
  padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px));
}

/* 30.2 Baris setting (label kiri + kontrol kanan) menumpuk jadi vertikal
   di layar sempit: label 2-3 baris + input mepet tepi + FAB menimpa kontrol. */
@media (max-width: 560px) {
  .set-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s2);
  }
  .set-row .set-ctl {
    width: 100%;
    justify-content: flex-start;
  }
  .set-row .set-ctl .input,
  .set-row .set-ctl .select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
}

/* 30.3 FAB asisten: jangan menimpa kontrol form di layar sempit — cukup
   beri ruang aman di bawah konten dan kecilkan sedikit FAB-nya. */
@media (max-width: 560px) {
  .ai-fab {
    right: var(--s3);
    bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px));
    width: 48px;
    height: 48px;
  }
  .content { padding-bottom: calc(var(--s6) + 72px); }
}

/* 30.4 Chip status di topbar (mis. "WA terhubung") tidak boleh wrap jadi
   2 baris di layar sempit — biarkan menyusut dengan ellipsis. */
.topbar .badge,
.topbar .admin-chip {
  white-space: nowrap;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 30.5 Navbar & hero landing (index.html): brand + dua tombol tidak muat di
   layar sempit sehingga halaman meluber ~90px ke kanan (bisa digeser samping
   di HP); ilustrasi gelombang yang lebarnya tetap 420px ikut meluber. Rapatkan
   navbar, sembunyikan tombol "Daftar Gratis" di navbar (CTA utamanya tetap ada
   di hero), dan biarkan ilustrasi mengecil mengikuti lebar layar. */
@media (max-width: 560px) {
  .pnav { padding: 0 var(--s4); gap: var(--s2); }
  .pnav .brand-mark { width: 34px; height: 34px; }
  .pnav .brand .n { font-size: 15px; }
  .pnav .brand .s { display: none; }
  .pnav .btn { height: 34px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
  .pnav .btn svg { width: 14px; height: 14px; }
  .nav-daftar { display: none; }
  .phero-art { width: 100%; margin-left: 0 !important; }
  .phero-art svg, .phero-art img { width: 100%; height: auto; }
}
