:root {
  --p: #667eea; --pd: #764ba2;
  --ap: #2c3e50; --aa: #3498db;
  --g: #27ae60; --r: #e74c3c; --y: #f39c12; --bl: #3498db;
  --bg: #f0f2f5; --tx: #333; --lt: #888; --bd: #e8e8e8;
  --max-w: 480px;
}

/* RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--tx);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
}

/* ==========================================
   MOBILE WRAPPER - Semua konten di tengah
   max-width 480px seperti app HP
   ========================================== */
.app-wrap {
  width: 100%;
  max-width: var(--max-w);
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 30px rgba(0,0,0,.08);
}

/* ==========================================
   LOGIN
   ========================================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-wrap.anggota { background: linear-gradient(135deg, var(--p), var(--pd)); }
.login-wrap.admin { background: linear-gradient(135deg, var(--ap), var(--aa)); }

.login-box {
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 3px solid rgba(255,255,255,.3);
  box-shadow: 0 4px 15px rgba(0,0,0,.1);
}
.login-box h2 { font-size: 1.3em; margin-bottom: 2px; }
.login-box .sub { color: #999; font-size: .82em; margin-bottom: 22px; }
.login-box .sub2 { margin-top: 18px; font-size: .7em; color: #bbb; }

/* ==========================================
   HEADER
   ========================================== */
.hdr {
  color: #fff;
  padding: 12px 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.hdr.anggota { background: linear-gradient(135deg, var(--p), var(--pd)); }
.hdr.admin { background: linear-gradient(135deg, var(--ap), var(--aa)); }
.hdr-row { display: flex; justify-content: space-between; align-items: center; }
.hdr-left { display: flex; align-items: center; gap: 10px; }
.hdr-logo {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
}
.hdr h1 { font-size: 1em; line-height: 1.2; }
.hdr .sub { font-size: .68em; opacity: .85; }
.btn-out {
  background: rgba(255,255,255,.2);
  border: none; color: #fff;
  padding: 5px 12px; border-radius: 6px;
  font-size: .72em; cursor: pointer;
  white-space: nowrap;
}

/* ==========================================
   NAV BOTTOM STYLE
   ========================================== */
.nav {
  display: flex;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky; top: 52px; z-index: 99;
  overflow-x: auto;
}
.nav button {
  flex: 1;
  padding: 8px 2px;
  border: none; background: #fff;
  cursor: pointer;
  font-size: .6em; color: #aaa;
  text-align: center;
  border-bottom: 2.5px solid transparent;
  transition: .2s;
  white-space: nowrap;
}
.nav button.on { font-weight: 700; }
.nav.anggota button.on { color: var(--p); border-bottom-color: var(--p); }
.nav.admin button.on { color: var(--aa); border-bottom-color: var(--aa); }
.nav .ico { font-size: 1.2em; display: block; margin-bottom: 1px; }

/* ==========================================
   CONTENT
   ========================================== */
.cnt {
  padding: 12px;
  padding-bottom: 40px;
}
.pg { display: none; }
.pg.on { display: block; }

/* ==========================================
   FORMS
   ========================================== */
.fg { margin-bottom: 12px; }
.fg label {
  display: block;
  font-weight: 600; font-size: .75em;
  color: #555; margin-bottom: 4px;
}
.fg input, .fg select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--bd);
  border-radius: 10px;
  font-size: .88em;
  -webkit-appearance: none;
}
.fg input:focus, .fg select:focus {
  outline: none;
  border-color: var(--p);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  padding: 9px 16px; border: none;
  border-radius: 10px;
  font-size: .82em; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.btn:active { transform: scale(.97); }
.btn-p {
  color: #fff; width: 100%;
  padding: 12px; font-size: .9em;
}
.btn-p.anggota { background: linear-gradient(135deg, var(--p), var(--pd)); }
.btn-p.admin { background: var(--aa); }
.btn-p:disabled { opacity: .5; }
.btn-g { background: var(--g); color: #fff; }
.btn-r { background: var(--r); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .7em; }
.btn-book {
  background: var(--p); color: #fff;
  padding: 7px 14px; font-size: .73em;
  margin-top: 8px; border: none;
  border-radius: 8px; cursor: pointer;
}
.btn-wa {
  background: #25d366; color: #fff;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px;
  font-size: .73em; font-weight: 600;
}

/* ==========================================
   SEARCH
   ========================================== */
.srch { position: relative; margin-bottom: 10px; }
.srch input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 2px solid var(--bd);
  border-radius: 12px;
  font-size: .88em;
}
.srch input:focus { outline: none; border-color: var(--p); }
.srch .si {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 1em;
}

/* ==========================================
   FILTER CHIPS
   ========================================== */
.flt {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.fb {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--bd);
  background: #fff;
  font-size: .73em;
  cursor: pointer;
  font-weight: 500;
  transition: .2s;
  white-space: nowrap;
}
.fb:active {
  transform: scale(.95);
}
.fb.on {
  background: var(--p);
  color: #fff;
  border-color: var(--p);
}

/* ==========================================
   BUKU CARD
   ========================================== */
.bc {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
  display: flex; gap: 10px;
}
.bcv {
  width: 46px; height: 62px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4em;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--p), var(--pd));
  color: #fff;
}
.bi { flex: 1; min-width: 0; }
.bt {
  font-weight: 700; font-size: .88em;
  margin-bottom: 1px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ba { font-size: .75em; color: #999; }
.bm {
  font-size: .7em; color: #aaa;
  margin-top: 4px;
  display: flex; align-items: center;
  gap: 5px; flex-wrap: wrap;
}

/* ==========================================
   BADGE
   ========================================== */
.bd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .64em;
  font-weight: 600;
}
.bd-g { background: #e8f5e9; color: var(--g); }
.bd-r { background: #fde8e8; color: var(--r); }
.bd-y { background: #fff8e1; color: var(--y); }
.bd-b { background: #e3f2fd; color: var(--bl); }
.bd-gr { background: #f5f5f5; color: #95a5a6; }

/* ==========================================
   BOOKING ITEM
   ========================================== */
.bo {
  background: #fff;
  border-left: 4px solid var(--p);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 5px rgba(0,0,0,.04);
}
.bo.st-a { border-left-color: var(--g); }
.bo.st-r { border-left-color: var(--r); }
.bo.st-b { border-left-color: var(--y); }
.bo.st-d { border-left-color: #95a5a6; }

/* ==========================================
   ADMIN: STATS GRID
   ========================================== */
.sg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.sc {
  background: #fff;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  box-shadow: 0 1px 5px rgba(0,0,0,.04);
}
.sn { font-size: 1.5em; font-weight: 700; color: var(--aa); }
.sl { font-size: .6em; color: var(--lt); margin-top: 1px; }
.sc.w .sn { color: var(--r); }
.sc.a .sn { color: var(--y); }

/* ==========================================
   ADMIN: CARD & BOOKING CARD
   ========================================== */
.cd {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.cd h3 { font-size: .9em; margin-bottom: 10px; }

.bk {
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fafafa;
}
.bk h4 { font-size: .85em; margin-bottom: 3px; }
.bk .mt { font-size: .73em; color: var(--lt); line-height: 1.5; }
.bk .ac {
  display: flex; gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.li:last-child { border: none; }
.li .tt { font-weight: 600; font-size: .82em; }
.li .su { font-size: .7em; color: var(--lt); margin-top: 2px; }

/* ==========================================
   MODAL
   ========================================== */
.mo-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.mo {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  width: 100%;
  max-width: var(--max-w);
  max-height: 85vh;
  overflow-y: auto;
  animation: moUp .3s ease;
}
@keyframes moUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.mo h3 { margin-bottom: 14px; font-size: .95em; }
.mc {
  float: right;
  background: #f0f0f0;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1em;
  cursor: pointer;
  color: #888;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================
   TOAST
   ========================================== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  color: #fff;
  font-size: .78em;
  z-index: 1000;
  max-width: calc(var(--max-w) - 40px);
  text-align: center;
  animation: ti .3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.t-ok { background: var(--g); }
.t-er { background: var(--r); }
.t-in { background: var(--bl); }
@keyframes ti {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================
   LOADING & EMPTY STATE
   ========================================== */
.ld { text-align: center; padding: 40px 16px; color: #bbb; }
.ld p { font-size: .8em; margin-top: 8px; }
.sp {
  display: inline-block;
  width: 28px; height: 28px;
  border: 3px solid #e8e8e8;
  border-top-color: var(--p);
  border-radius: 50%;
  animation: s .7s linear infinite;
}
.sp.admin { border-top-color: var(--aa); }
@keyframes s { to { transform: rotate(360deg); } }

.emp { text-align: center; padding: 50px 16px; color: #ccc; }
.emp .emo { font-size: 2.5em; margin-bottom: 8px; }
.emp p { font-size: .85em; }
.emp .sub { font-size: .75em; margin-top: 4px; }

/* ==========================================
   DESKTOP: Tetap narrow di tengah
   ========================================== */
@media (min-width: 481px) {
  body { background: #e0e3e8; }
  .app-wrap {
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
  }
  .login-wrap {
    max-width: var(--max-w);
    margin: 0 auto;
  }
}