/* ===================================================================
 * MAJU DAILY OPS — Mobile-first stylesheet
 * Brand color: #1F3864 (deep blue)
 * =================================================================== */

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #F5F7FB;
  color: #1A1F36;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: #1F3864; text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: #6B7280; }
.small { font-size: 11px; }
.center { text-align: center; }
.hidden { display: none !important; }

code {
  background: #F3F4F6;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', Menlo, Monaco, monospace;
  font-size: 11px;
}

/* ============ TOPBAR ============ */
.topbar {
  background: linear-gradient(135deg, #1F3864 0%, #2A4A87 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.topbar .brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}
.topbar .muted { color: rgba(255,255,255,0.6); font-size: 11px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.user-info strong { font-size: 12px; }
.user-info .badge-role {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.15);
  padding: 2px 6px;
  border-radius: 3px;
}

.btn-ghost {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,0.25); }

/* ============ MAIN ============ */
.main { max-width: 800px; margin: 0 auto; padding: 12px; }

/* ============ CARDS ============ */
.card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #E5E7EB;
}
.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1F3864;
}
.card h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.card h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6B7280;
  margin-bottom: 8px;
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #374151;
}
input[type="text"], input[type="tel"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #1F3864;
  box-shadow: 0 0 0 3px rgba(31, 56, 100, 0.1);
}
textarea { resize: vertical; min-height: 60px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: normal;
  margin-bottom: 6px;
  cursor: pointer;
}
.checkbox-label input { width: auto; }

/* ============ BUTTONS ============ */
.btn-primary, .btn-secondary, .btn-danger, .btn-full {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn-primary {
  background: #1F3864;
  color: white;
}
.btn-primary:hover { background: #2A4A87; }
.btn-secondary {
  background: white;
  color: #1F3864;
  border-color: #D1D5DB;
}
.btn-secondary:hover { background: #F3F4F6; }
.btn-danger {
  background: #DC2626;
  color: white;
}
.btn-danger:hover { background: #B91C1C; }
.btn-full { width: 100%; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ ALERTS ============ */
.alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  border-left: 3px solid;
}
.alert-error { background: #FEF2F2; color: #991B1B; border-color: #DC2626; }
.alert-success { background: #ECFDF5; color: #065F46; border-color: #10B981; }
.alert-info { background: #EFF6FF; color: #1E40AF; border-color: #3B82F6; }
.alert-warn { background: #FFFBEB; color: #92400E; border-color: #F59E0B; }

/* ============ LOGIN PAGE ============ */
.login-body {
  background: linear-gradient(135deg, #1F3864 0%, #5B7BB8 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-container { width: 100%; max-width: 380px; }
.login-card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-header { text-align: center; margin-bottom: 20px; }
.login-header .badge {
  display: inline-block;
  background: #1F3864;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.login-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-message {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  min-height: 16px;
}
.login-message.success { color: #065F46; }
.login-message.error { color: #991B1B; }
.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  border-top: 1px solid #E5E7EB;
  padding-top: 16px;
}

/* ============ MOBILE TABS (FL/Promotor) ============ */
.mobile-shell { padding-bottom: 20px; }
.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: white;
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tab {
  background: transparent;
  border: none;
  padding: 8px 4px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #6B7280;
}
.tab.active {
  background: #1F3864;
  color: white;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ COUNTERS ============ */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.counter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.counter-item {
  background: #F9FAFB;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  border: 1px solid #E5E7EB;
}
.counter-item.highlight {
  background: #EFF6FF;
  border-color: #3B82F6;
}
.counter-item label {
  font-size: 10px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.counter-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.counter-btn {
  background: white;
  border: 1px solid #D1D5DB;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: #1F3864;
  flex-shrink: 0;
}
.counter-btn:hover { background: #1F3864; color: white; }
.counter-value {
  font-size: 18px;
  font-weight: 700;
  color: #1F3864;
  min-width: 30px;
  text-align: center;
}

/* ============ LEASING ============ */
.leasing-block { margin-bottom: 12px; padding: 10px; background: #F9FAFB; border-radius: 6px; }
.leasing-block:last-child { margin-bottom: 0; }

/* ============ FILTER TABS ============ */
.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-tab {
  background: white;
  border: 1px solid #D1D5DB;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
}
.filter-tab.active {
  background: #1F3864;
  color: white;
  border-color: #1F3864;
}
.filter-tab .count {
  display: inline-block;
  background: rgba(0,0,0,0.1);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  font-size: 10px;
}
.filter-tab.active .count { background: rgba(255,255,255,0.25); }

/* ============ LEAD CARDS ============ */
.lead-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-left: 3px solid #378ADD;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.lead-card.warm { border-left-color: #EF9F27; }
.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.lead-name { font-weight: 700; font-size: 13px; }
.lead-phone { font-size: 11px; color: #6B7280; font-family: monospace; }
.lead-location { font-size: 11px; color: #6B7280; margin-top: 2px; }
.lead-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.lead-status-badge.warm { background: #FEF3C7; color: #92400E; }
.lead-status-badge.cold { background: #DBEAFE; color: #1E40AF; }

.lead-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 10px;
}
.lead-meta-chip {
  background: #F3F4F6;
  padding: 3px 7px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.lead-meta-chip.stale { background: #FEE2E2; color: #991B1B; }
.lead-meta-chip.fresh { background: #D1FAE5; color: #065F46; }

.lead-interest {
  background: #F9FAFB;
  padding: 8px;
  border-radius: 5px;
  margin: 6px 0;
  font-size: 12px;
}
.lead-interest .notes { color: #6B7280; font-style: italic; margin-top: 4px; font-size: 11px; }

.lead-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.lead-btn {
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #D1D5DB;
  background: white;
  cursor: pointer;
}
.lead-btn.primary { background: #548235; color: white; border-color: #548235; flex: 1; }

.history-toggle {
  width: 100%;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
}
.history-list {
  border-left: 2px solid #E5E7EB;
  padding-left: 10px;
  margin: 6px 0;
}
.history-item {
  font-size: 10px;
  margin-bottom: 6px;
}
.history-item .ts { color: #6B7280; font-family: monospace; }
.history-item .change-status { font-weight: 700; }
.history-item .note { color: #4B5563; font-style: italic; margin-top: 2px; }

/* ============ ALERTS LIST ============ */
.alerts-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 0 4px;
}
.alert-item {
  background: white;
  border: 2px solid;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.alert-item.green { background: #ECFDF5; border-color: #A7F3D0; }
.alert-item.amber { background: #FFFBEB; border-color: #FDE68A; }
.alert-item.red { background: #FEF2F2; border-color: #FECACA; }
.alert-item.blue { background: #EFF6FF; border-color: #BFDBFE; }
.alert-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.alert-item-title { font-size: 11px; font-weight: 700; flex: 1; }
.alert-item-time { font-size: 10px; color: #6B7280; font-family: monospace; }
.alert-item-status {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: monospace;
  white-space: nowrap;
}
.alert-item-status.green { background: #D1FAE5; color: #065F46; }
.alert-item-status.amber { background: #FEF3C7; color: #92400E; }
.alert-item-status.red { background: #FEE2E2; color: #991B1B; }
.alert-item-status.blue { background: #DBEAFE; color: #1E40AF; }
.alert-item-result { font-size: 10px; color: #4B5563; margin-top: 4px; font-style: italic; }
.alert-item-trail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 10px;
}
.alert-item-type {
  font-size: 9px;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ============ HS DASHBOARD ============ */
.hs-shell .hs-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: white;
  padding: 6px;
  border-radius: 8px;
  overflow-x: auto;
}
.personnel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.personnel-col h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: #6B7280;
  margin-bottom: 6px;
}
.personnel-card {
  background: #F9FAFB;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}
.personnel-card.submitted { background: #D1FAE5; }
.personnel-card.pending { background: #FEF3C7; }
.personnel-card.libur { background: #F3F4F6; color: #6B7280; }

.cr-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.cr-card.pending { border-left: 3px solid #F59E0B; }
.cr-card.approved { border-left: 3px solid #10B981; }
.cr-card.rejected { border-left: 3px solid #DC2626; }
.cr-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6B7280;
  line-height: 1;
}
.modal h3 { margin-bottom: 8px; font-size: 16px; }

.form-actions {
  display: flex;
  gap: 8px;
}
.form-actions button { flex: 1; }

#formStatus { margin-top: 8px; text-align: center; font-size: 11px; }

/* ============ EXEC DASHBOARD ============ */
.exec-shell { padding: 0; }
.card-grid { display: grid; gap: 12px; margin-top: 12px; }
.info-card {
  background: #F9FAFB;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #E5E7EB;
}
.info-card ul { padding-left: 18px; line-height: 1.8; }

/* ============ RESPONSIVE — desktop tweaks ============ */
@media (min-width: 768px) {
  .main { padding: 20px; }
  .counter-grid { grid-template-columns: repeat(3, 1fr); }
  .mobile-tabs { max-width: 600px; }
}
