* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f0f1a;
  --bg2: #1a1a2e;
  --bg3: #16213e;
  --card: #1e1e36;
  --border: #2a2a4a;
  --primary: #e94560;
  --primary-dark: #c73650;
  --accent: #0f3460;
  --green: #00c853;
  --red: #ff1744;
  --orange: #ff9100;
  --yellow: #ffd600;
  --text: #f1f1f1;
  --text2: #a0a0b8;
  --text3: #6c6c8a;
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.page { display: none; height: 100%; }
.page.active { display: flex; flex-direction: column; }

/* LOGIN */
.login-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 24px; text-align: center;
}
.login-logo { font-size: 64px; margin-bottom: 8px; }
.login-container h1 { font-size: 24px; color: var(--primary); margin-bottom: 4px; }
.login-subtitle { color: var(--text2); margin-bottom: 32px; font-size: 14px; }
.login-container form { width: 100%; max-width: 320px; }

/* FORMS */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.form-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.97); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-icon { background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; padding: 4px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; min-height: 20px; }

/* HEADER */
#app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg2); border-bottom: 1px solid var(--border);
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
}
#header-title { font-size: 18px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 10px; }
#header-user { font-size: 13px; color: var(--text2); }

/* BOTTOM NAV */
#bottom-nav {
  display: flex; background: var(--bg2); border-top: 1px solid var(--border);
  padding: 6px 0; padding-bottom: calc(6px + var(--safe-bottom));
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--text3); font-size: 11px; cursor: pointer;
  padding: 6px 0; transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-weight: 500; }

/* APP SHELL */
#app-shell { height: 100%; display: flex; flex-direction: column; }

/* MAIN CONTENT */
#app-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-top: 52px; padding-bottom: 64px;
}
.content-pad { padding: 16px; }

/* CARDS */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px; border: 1px solid var(--border);
}
.card-title { font-size: 14px; color: var(--text2); margin-bottom: 8px; font-weight: 500; }
.card-value { font-size: 28px; font-weight: 700; }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card { text-align: center; padding: 14px 10px; }
.stat-card .card-value { font-size: 24px; }
.stat-accent { color: var(--primary); }
.stat-green { color: var(--green); }
.stat-orange { color: var(--orange); }
.stat-red { color: var(--red); }

/* BOOKING CARD */
.booking-card { position: relative; }
.booking-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.booking-tamu { font-size: 16px; font-weight: 600; }
.booking-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-aktif { background: rgba(0,200,83,0.15); color: var(--green); }
.badge-pending { background: rgba(255,145,0,0.15); color: var(--orange); }
.badge-selesai { background: rgba(108,108,138,0.15); color: var(--text3); }
.badge-batal { background: rgba(255,23,68,0.15); color: var(--red); }
.booking-info { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text2); }
.booking-info-row { display: flex; align-items: center; gap: 8px; }
.booking-info-row .emoji { width: 20px; text-align: center; flex-shrink: 0; }

/* JEMPUT BOX — highlight penting */
.jemput-box {
  background: var(--accent); border-radius: var(--radius-sm); padding: 10px 12px;
  margin: 10px 0; font-size: 13px; line-height: 1.6;
}
.jemput-box strong { color: var(--yellow); }

/* SETORAN */
.setoran-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.setoran-belum { background: rgba(255,23,68,0.15); color: var(--red); }
.setoran-sudah { background: rgba(0,200,83,0.15); color: var(--green); }

/* CALENDAR */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.cal-month { font-size: 16px; font-weight: 600; min-width: 140px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-name { text-align: center; font-size: 11px; color: var(--text3); font-weight: 600; padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer;
  position: relative; transition: all 0.15s;
}
.cal-day:hover { background: var(--bg3); }
.cal-day.empty { cursor: default; }
.cal-day.empty:hover { background: transparent; }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.booked { background: var(--red); color: #fff; font-weight: 700; }
.cal-day.booked:hover { background: #d81540; }

.cal-filter { margin-bottom: 12px; }
.cal-filter select { width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; }

.cal-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--text2); }
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.cal-legend-dot.free { background: var(--bg3); }
.cal-legend-dot.full { background: var(--red); }

/* DAY DETAIL */
.day-detail { margin-top: 16px; }
.day-detail-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* MASTER DATA TABS */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px; color: var(--text2); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* TABLE */
.data-table { width: 100%; overflow-x: auto; }
.data-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 8px; color: var(--text2); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* TOAST */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--text); padding: 12px 24px;
  border-radius: 30px; font-size: 14px; z-index: 100; border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); animation: toastIn 0.3s;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } }

/* MODAL */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 50; display: flex;
  align-items: flex-end; justify-content: center;
}
.modal-content {
  background: var(--bg2); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto;
  padding: 20px; animation: slideUp 0.3s;
}
@keyframes slideUp { from { transform: translateY(100%); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 24px; cursor: pointer; }

/* SECTION TITLE */
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text2); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ACTION BUTTONS ROW */
.action-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
