/* ===========================================
   RONDE 5R — Mobile-First CSS
   =========================================== */

:root {
  --green:       #1a6b3c;
  --green-dark:  #145530;
  --green-light: #e8f5ee;
  --red:         #e74c3c;
  --orange:      #f39c12;
  --blue:        #3498db;
  --gray:        #6c757d;
  --gray-light:  #f8f9fa;
  --border:      #dee2e6;
  --text:        #212529;
  --text-muted:  #6c757d;
  --white:       #ffffff;
  --shadow:      0 2px 8px rgba(0,0,0,0.10);
  --radius:      12px;
  --radius-sm:   8px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px; /* space for bottom nav */
}

a { text-decoration: none; color: inherit; }

/* ===========================================
   HEADER
   =========================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: 56px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo {
  background: var(--white);
  color: var(--green);
  font-weight: 900;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}
.header-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.header-sub   { font-size: 11px; opacity: 0.85; }
.header-center { font-weight: 700; font-size: 16px; flex: 1; text-align: center; }

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.25); }

/* ===========================================
   MAIN CONTENT
   =========================================== */
.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.section-title {
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 20px 0 10px;
}

/* ===========================================
   LOGIN PAGE
   =========================================== */
.login-page {
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: 20px; /* override global */
}

.login-container {
  background: var(--white);
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--green);
  color: var(--white);
  font-weight: 900;
  font-size: 20px;
  border-radius: 16px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.login-logo h1 { font-size: 22px; color: var(--green); margin-bottom: 4px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
.login-footer  { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 20px; }

/* ===========================================
   FORMS
   =========================================== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group label.required::after { content: ' *'; color: var(--red); }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.15);
}
.input-disabled { background: var(--gray-light); color: var(--text-muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

/* Radio group untuk jenis R */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.radio-item input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green); flex-shrink: 0; }
.radio-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background: var(--gray-light);
  transition: border-color 0.2s;
}
.upload-area:active { border-color: var(--green); background: var(--green-light); }
.upload-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.upload-area span { display: block; font-size: 14px; color: var(--text-muted); }
.upload-area small { font-size: 12px; color: #aaa; }

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline  { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-warning  { background: var(--orange); color: var(--white); }
.btn-success  { background: #27ae60; color: var(--white); }
.btn-full     { width: 100%; }
.btn-lg       { padding: 14px 18px; font-size: 16px; }
.btn-sm       { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* ===========================================
   STATS & CARDS
   =========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  background: var(--white);
  box-shadow: var(--shadow);
}
.stat-num   { font-size: 24px; font-weight: 900; line-height: 1; }
.stat-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.stat-total   { border-top: 3px solid var(--green); }
.stat-total .stat-num { color: var(--green); }
.stat-baru    { border-top: 3px solid var(--red); }
.stat-baru .stat-num { color: var(--red); }
.stat-progress{ border-top: 3px solid var(--orange); }
.stat-progress .stat-num { color: var(--orange); }
.stat-selesai { border-top: 3px solid #27ae60; }
.stat-selesai .stat-num { color: #27ae60; }

/* Action grid */
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.action-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.1s;
}
.action-card:active { transform: scale(0.97); border-color: var(--green); }
.action-icon { font-size: 28px; }
.action-add   { border-color: var(--green); color: var(--green); }

/* ===========================================
   TEMUAN CARDS
   =========================================== */
.temuan-list { display: flex; flex-direction: column; gap: 10px; }

.temuan-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: block;
  border-left: 4px solid var(--border);
  transition: transform 0.1s;
}
.temuan-card:active { transform: scale(0.98); }
.temuan-overdue { border-left-color: var(--red) !important; }

.temuan-card-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.temuan-kode     { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }
.temuan-lokasi   { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.temuan-desc     { font-size: 13px; color: var(--text-muted); line-height: 1.4; margin-bottom: 8px; }
.temuan-meta     { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); }
.temuan-deadline { font-size: 11px; margin-top: 6px; color: var(--text-muted); }
.temuan-deadline.overdue { color: var(--red); font-weight: 600; }

/* ===========================================
   BADGES
   =========================================== */
.badge-jenis {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-r1 { background: #fde8e8; color: #c0392b; }
.badge-r2 { background: #fef3e2; color: #d35400; }
.badge-r3 { background: #e8f4fd; color: #2980b9; }
.badge-r4 { background: #e8f8f0; color: #1e8449; }
.badge-r5 { background: #f3e5f5; color: #7d3c98; }

.badge-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
}

.badge-role {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.role-ketua   { background: #1a6b3c; color: white; }
.role-pj_area { background: #3498db; color: white; }
.role-petugas { background: #95a5a6; color: white; }

.badge-self   { font-size: 11px; color: var(--text-muted); padding: 4px 8px; }

.badge-mini {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.badge-mini.baru    { background: #fde8e8; color: #c0392b; }
.badge-mini.selesai { background: #e8f8f0; color: #1e8449; }

/* ===========================================
   DETAIL PAGE
   =========================================== */
.detail-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.detail-header { display: flex; gap: 8px; margin-bottom: 8px; }
.detail-kode   { font-size: 13px; color: var(--text-muted); font-family: monospace; margin-bottom: 12px; }
.detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.detail-item.full { grid-column: 1/-1; }
.detail-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 2px; }
.detail-value  { font-size: 14px; font-weight: 600; }
.detail-desc   { font-size: 14px; line-height: 1.6; color: var(--text); margin-top: 4px; }
.detail-meta   { font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.foto-temuan   { width: 100%; border-radius: 8px; margin-top: 6px; }

.update-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ===========================================
   FILTER & SEARCH
   =========================================== */
.filter-form   { margin-bottom: 12px; }
.search-bar    { display: flex; gap: 8px; margin-bottom: 8px; }
.search-bar input { flex: 1; }
.btn-search    { padding: 12px 14px; background: var(--green); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 16px; cursor: pointer; }
.filter-row    { display: flex; gap: 8px; }
.filter-row select { flex: 1; padding: 10px 10px; font-size: 13px; }
.result-info   { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

/* ===========================================
   REKAP
   =========================================== */
.rekap-period  { font-size: 14px; font-weight: 700; color: var(--green); margin-bottom: 12px; }

.progress-section { background: var(--white); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 4px; box-shadow: var(--shadow); }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.progress-bar   { height: 10px; background: #e9ecef; border-radius: 99px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--green); border-radius: 99px; transition: width 0.5s ease; }

.rekap-table { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rekap-row   { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.rekap-row:last-child { border-bottom: none; }
.rekap-label { font-size: 13px; flex: 1; }
.rekap-detail{ display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.rekap-num   { font-weight: 700; font-size: 16px; min-width: 30px; text-align: right; }
.flex-1      { flex: 1; }
.overdue-title { color: var(--red); }
.empty-state-sm { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ===========================================
   USER LIST
   =========================================== */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card  {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.user-inactive { opacity: 0.5; }
.user-nama     { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.user-meta     { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.user-username { font-size: 11px; color: var(--text-muted); }
.user-area     { font-size: 11px; color: var(--text-muted); }
.user-actions  { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }

/* ===========================================
   COLLAPSIBLE
   =========================================== */
.collapsible {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.collapsible-title {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.collapsible-title::-webkit-details-marker { display: none; }
.collapsible-body { padding: 0 16px 16px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ===========================================
   BOTTOM NAV
   =========================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 16px;
  border-radius: 8px;
  transition: color 0.2s;
}
.nav-item.active { color: var(--green); font-weight: 700; }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-add  { padding: 0; }
.nav-add-icon {
  width: 48px;
  height: 48px;
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-top: -20px;
  box-shadow: 0 4px 12px rgba(26,107,60,0.4);
}

/* ===========================================
   ALERTS
   =========================================== */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
  font-weight: 500;
}
.alert-error   { background: #fde8e8; color: #c0392b; border-left: 4px solid #c0392b; }
.alert-success { background: #e8f5ee; color: #1e8449; border-left: 4px solid #1e8449; }

/* ===========================================
   MODAL
   =========================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-box {
  position: relative;
  background: var(--white);
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  z-index: 1;
}
.modal-box h3   { margin-bottom: 16px; font-size: 16px; }
.modal-actions  { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ===========================================
   PAGINATION & MISC
   =========================================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 8px;
}
.page-info { font-size: 13px; color: var(--text-muted); }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--white);
  border-radius: var(--radius);
}
